@@ -342,30 +342,29 @@ public virtual Signature BuildSignature(DateTimeOffset now)
342342
343343 internal Signature BuildSignature ( DateTimeOffset now , bool shouldThrowIfNotFound )
344344 {
345- var name = Get < string > ( "user.name" ) ;
346- var email = Get < string > ( "user.email" ) ;
345+ var name = this . GetValueOrDefault < string > ( "user.name" ) ;
346+ var email = this . GetValueOrDefault < string > ( "user.email" ) ;
347347
348- if ( shouldThrowIfNotFound )
348+ if ( shouldThrowIfNotFound && ( string . IsNullOrEmpty ( name ) || string . IsNullOrEmpty ( email ) ) )
349349 {
350- if ( name == null || string . IsNullOrEmpty ( name . Value ) )
350+ if ( string . IsNullOrEmpty ( name ) )
351351 {
352352 throw new LibGit2SharpException (
353- "Can not find Name setting of the current user in Git configuration." ) ;
353+ "Cannot find Name setting of the current user in Git configuration." ) ;
354354 }
355355
356- if ( email == null || string . IsNullOrEmpty ( email . Value ) )
356+ if ( string . IsNullOrEmpty ( email ) )
357357 {
358358 throw new LibGit2SharpException (
359- "Can not find Email setting of the current user in Git configuration." ) ;
359+ "Cannot find Email setting of the current user in Git configuration." ) ;
360360 }
361361 }
362362
363- var nameForSignature = name == null || string . IsNullOrEmpty ( name . Value ) ? "unknown" : name . Value ;
364- var emailForSignature = email == null || string . IsNullOrEmpty ( email . Value )
365- ? string . Format ( "{0}@{1}" , Environment . UserName , Environment . UserDomainName )
366- : email . Value ;
367-
368- return new Signature ( nameForSignature , emailForSignature , now ) ;
363+ return new Signature (
364+ ! string . IsNullOrEmpty ( name ) ? name : "unknown" ,
365+ ! string . IsNullOrEmpty ( email ) ? email : string . Format (
366+ CultureInfo . InvariantCulture , "{0}@{1}" , Environment . UserName , Environment . UserDomainName ) ,
367+ now ) ;
369368 }
370369
371370 private ConfigurationSafeHandle Snapshot ( )
0 commit comments