@@ -250,44 +250,21 @@ public static void ArgumentPositiveInt32(long argumentValue, string argumentName
250
250
/// <param name="identifier">The <see cref="GitObject"/> identifier to examine.</param>
251
251
public static void GitObjectIsNotNull ( GitObject gitObject , string identifier )
252
252
{
253
- Func < string , LibGit2SharpException > exceptionBuilder ;
254
-
255
- if ( string . Equals ( "HEAD" , identifier , StringComparison . Ordinal ) )
256
- {
257
- exceptionBuilder = m => new UnbornBranchException ( m ) ;
258
- }
259
- else
253
+ if ( gitObject != null )
260
254
{
261
- exceptionBuilder = m => new NotFoundException ( m ) ;
255
+ return ;
262
256
}
263
257
264
- GitObjectIsNotNull ( gitObject , identifier , exceptionBuilder ) ;
265
- }
266
-
258
+ var message = string . Format ( CultureInfo . InvariantCulture ,
259
+ "No valid git object identified by '{0}' exists in the repository." ,
260
+ identifier ) ;
267
261
268
- /// <summary>
269
- /// Check that the result of a C call that returns a non-null GitObject
270
- /// using the default exception builder.
271
- /// <para>
272
- /// The native function is expected to return a valid object value.
273
- /// </para>
274
- /// </summary>
275
- /// <param name="gitObject">The <see cref="GitObject"/> to examine.</param>
276
- /// <param name="identifier">The <see cref="GitObject"/> identifier to examine.</param>
277
- /// <param name="exceptionBuilder">The builder which constructs an <see cref="LibGit2SharpException"/> from a message.</param>
278
- public static void GitObjectIsNotNull (
279
- GitObject gitObject ,
280
- string identifier ,
281
- Func < string , LibGit2SharpException > exceptionBuilder )
282
- {
283
- if ( gitObject != null )
262
+ if ( string . Equals ( "HEAD" , identifier , StringComparison . Ordinal ) )
284
263
{
285
- return ;
264
+ throw new UnbornBranchException ( message ) ;
286
265
}
287
266
288
- throw exceptionBuilder ( string . Format ( CultureInfo . InvariantCulture ,
289
- "No valid git object identified by '{0}' exists in the repository." ,
290
- identifier ) ) ;
267
+ throw new NotFoundException ( message ) ;
291
268
}
292
269
}
293
270
}
0 commit comments