@@ -173,7 +173,7 @@ private static Commit LookUpCommit(IRepository repository, string committish)
173
173
/// <returns>The generated <see cref = "LibGit2Sharp.Commit" />.</returns>
174
174
public static Commit Commit ( this IRepository repository , string message , bool amendPreviousCommit = false )
175
175
{
176
- Signature author = BuildSignatureFromGlobalConfiguration ( repository , DateTimeOffset . Now ) ;
176
+ Signature author = repository . Config . BuildSignatureFromGlobalConfiguration ( DateTimeOffset . Now ) ;
177
177
178
178
return repository . Commit ( message , author , amendPreviousCommit ) ;
179
179
}
@@ -191,7 +191,7 @@ public static Commit Commit(this IRepository repository, string message, bool am
191
191
/// <returns>The generated <see cref = "LibGit2Sharp.Commit" />.</returns>
192
192
public static Commit Commit ( this IRepository repository , string message , Signature author , bool amendPreviousCommit = false )
193
193
{
194
- Signature committer = BuildSignatureFromGlobalConfiguration ( repository , DateTimeOffset . Now ) ;
194
+ Signature committer = repository . Config . BuildSignatureFromGlobalConfiguration ( DateTimeOffset . Now ) ;
195
195
196
196
return repository . Commit ( message , author , committer , amendPreviousCommit ) ;
197
197
}
@@ -224,19 +224,6 @@ public static void Fetch(this IRepository repository, string remoteName,
224
224
onTransferProgress , credentials ) ;
225
225
}
226
226
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." )
6474
;
235
- }
236
-
237
- return new Signature ( name . Value , email . Value , now ) ;
238
- }
239
-
240
227
/// <summary>
241
228
/// Checkout the specified <see cref = "Branch" />, reference or SHA.
242
229
/// </summary>
0 commit comments