@@ -15,13 +15,11 @@ public static partial class Commands
15
15
/// <param name="repository">The repository.</param>
16
16
/// <param name="merger">The signature to use for the merge.</param>
17
17
/// <param name="options">The options for fetch and merging.</param>
18
- public static MergeResult Pull ( Repository repository , Signature merger , PullOptions options )
18
+ public static MergeResult Pull ( Repository repository , Signature merger , PullOptions options = null )
19
19
{
20
20
Ensure . ArgumentNotNull ( repository , "repository" ) ;
21
- Ensure . ArgumentNotNull ( merger , "merger" ) ;
22
21
23
22
24
- options = options ?? new PullOptions ( ) ;
25
23
Branch currentBranch = repository . Head ;
26
24
27
25
if ( ! currentBranch . IsTracking )
@@ -34,7 +32,24 @@ public static MergeResult Pull(Repository repository, Signature merger, PullOpti
34
32
throw new LibGit2SharpException ( "No upstream remote for the current branch." ) ;
35
33
}
36
34
37
- Commands . Fetch ( repository , currentBranch . RemoteName , new string [ 0 ] , options . FetchOptions , null ) ;
35
+ return Pull ( repository , currentBranch . RemoteName , merger , options ) ;
36
+ }
37
+
38
+ /// <summary>
39
+ /// Fetch changes from the configured upstream remote and branch into the branch pointed at by HEAD.
40
+ /// </summary>
41
+ /// <param name="repository">The repository.</param>
42
+ /// <param name="remoteNameOrPath">The remote name or repository path.</param>
43
+ /// <param name="merger">The signature to use for the merge.</param>
44
+ /// <param name="options">The options for fetch and merging.</param>
45
+ public static MergeResult Pull ( Repository repository , string remoteNameOrPath , Signature merger , PullOptions options = null )
46
+ {
47
+ Ensure . ArgumentNotNull ( repository , "repository" ) ;
48
+ Ensure . ArgumentNotNull ( merger , "merger" ) ;
49
+
50
+
51
+ options = options ?? new PullOptions ( ) ;
52
+ Commands . Fetch ( repository , remoteNameOrPath , new string [ 0 ] , options . FetchOptions , null ) ;
38
53
return repository . MergeFetchedRefs ( merger , options . MergeOptions ) ;
39
54
}
40
55
}
0 commit comments