@@ -173,7 +173,7 @@ private static Commit LookUpCommit(IRepository repository, string committish)
173173 /// <returns>The generated <see cref = "LibGit2Sharp.Commit" />.</returns>
174174 public static Commit Commit ( this IRepository repository , string message , bool amendPreviousCommit = false )
175175 {
176- Signature author = BuildSignatureFromGlobalConfiguration ( repository , DateTimeOffset . Now ) ;
176+ Signature author = repository . Config . BuildSignatureFromGlobalConfiguration ( DateTimeOffset . Now ) ;
177177
178178 return repository . Commit ( message , author , amendPreviousCommit ) ;
179179 }
@@ -191,7 +191,7 @@ public static Commit Commit(this IRepository repository, string message, bool am
191191 /// <returns>The generated <see cref = "LibGit2Sharp.Commit" />.</returns>
192192 public static Commit Commit ( this IRepository repository , string message , Signature author , bool amendPreviousCommit = false )
193193 {
194- Signature committer = BuildSignatureFromGlobalConfiguration ( repository , DateTimeOffset . Now ) ;
194+ Signature committer = repository . Config . BuildSignatureFromGlobalConfiguration ( DateTimeOffset . Now ) ;
195195
196196 return repository . Commit ( message , author , committer , amendPreviousCommit ) ;
197197 }
@@ -224,19 +224,6 @@ public static void Fetch(this IRepository repository, string remoteName,
224224 onTransferProgress , credentials ) ;
225225 }
226226
227- private static Signature BuildSignatureFromGlobalConfiguration ( IRepository repository , DateTimeOffset now )
228- {
229- var name = repository . Config . Get < string > ( "user.name" ) ;
230- var email = repository . Config . Get < string > ( "user.email" ) ;
231-
232- if ( ( name == null ) || ( email == null ) )
233- {
234- throw new LibGit2SharpException ( "Can not find Name and Email settings of the current user in Git configuration." ) ;
235- }
236-
237- return new Signature ( name . Value , email . Value , now ) ;
238- }
239-
240227 /// <summary>
241228 /// Checkout the specified <see cref = "Branch" />, reference or SHA.
242229 /// </summary>
0 commit comments