diff options
author | Tim Clem <timothy.clem@gmail.com> | 2012-06-20 13:58:44 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2012-06-20 13:59:50 +0400 |
commit | 3916ea55d3800e0577f8f230ae795c4d7fb606d2 (patch) | |
tree | 7f9bcaa11b815a4961454b50006d4500c67b4a39 /LibGit2Sharp/RemoteCollection.cs | |
parent | bb202dc9b1428f8b9ec02473f95f6b140ee77a67 (diff) |
Delegate the handling of the default refSpec to libgit2 when creating a new Remote
Fix #164
Diffstat (limited to 'LibGit2Sharp/RemoteCollection.cs')
-rw-r--r-- | LibGit2Sharp/RemoteCollection.cs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/LibGit2Sharp/RemoteCollection.cs b/LibGit2Sharp/RemoteCollection.cs index 47921d42..fb85422c 100644 --- a/LibGit2Sharp/RemoteCollection.cs +++ b/LibGit2Sharp/RemoteCollection.cs @@ -91,9 +91,17 @@ namespace LibGit2Sharp /// <returns>A new <see cref = "Remote" />.</returns> public virtual Remote Add(string name, string url) { - string fetchRefSpec = string.Format("+refs/heads/*:refs/remotes/{0}/*", name); + Ensure.ArgumentNotNull(name, "name"); + Ensure.ArgumentNotNull(url, "url"); + + RemoteSafeHandle handle; + + Ensure.Success(NativeMethods.git_remote_add(out handle, repository.Handle, name, url)); - return Add(name, url, fetchRefSpec); + using (handle) + { + return Remote.CreateFromPtr(handle); + } } /// <summary> |