@@ -277,6 +277,17 @@ static int unpack_nondirectories(int n, unsigned long mask,
277277 return 0 ;
278278}
279279
280+ static int unpack_failed (struct unpack_trees_options * o , const char * message )
281+ {
282+ discard_index (& o -> result );
283+ if (!o -> gently ) {
284+ if (message )
285+ return error ("%s" , message );
286+ return -1 ;
287+ }
288+ return -1 ;
289+ }
290+
280291static int unpack_callback (int n , unsigned long mask , unsigned long dirmask , struct name_entry * names , struct traverse_info * info )
281292{
282293 struct cache_entry * src [MAX_UNPACK_TREES + 1 ] = { NULL , };
@@ -294,7 +305,7 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
294305 int cmp = compare_entry (ce , info , p );
295306 if (cmp < 0 ) {
296307 if (unpack_index_entry (ce , o ) < 0 )
297- return -1 ;
308+ return unpack_failed ( o , NULL ) ;
298309 continue ;
299310 }
300311 if (!cmp ) {
@@ -352,17 +363,6 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
352363 return mask ;
353364}
354365
355- static int unpack_failed (struct unpack_trees_options * o , const char * message )
356- {
357- discard_index (& o -> result );
358- if (!o -> gently ) {
359- if (message )
360- return error ("%s" , message );
361- return -1 ;
362- }
363- return -1 ;
364- }
365-
366366/*
367367 * N-way merge "len" trees. Returns 0 on success, -1 on failure to manipulate the
368368 * resulting index, -2 on failure to reflect the changes to the work tree.
@@ -617,7 +617,7 @@ static int verify_absent(struct cache_entry *ce, const char *action,
617617 * found "foo/." in the working tree.
618618 * This is tricky -- if we have modified
619619 * files that are in "foo/" we would lose
620- * it .
620+ * them .
621621 */
622622 ret = verify_clean_subdirectory (ce , action , o );
623623 if (ret < 0 )
0 commit comments