@@ -54,13 +54,14 @@ static void unlink_entry(char *name, char *last_symlink)
5454}
5555
5656static struct checkout state ;
57- static void check_updates (struct unpack_trees_options * o )
57+ static int check_updates (struct unpack_trees_options * o )
5858{
5959 unsigned cnt = 0 , total = 0 ;
6060 struct progress * progress = NULL ;
6161 char last_symlink [PATH_MAX ];
6262 struct index_state * index = & o -> result ;
6363 int i ;
64+ int errs = 0 ;
6465
6566 if (o -> update && o -> verbose_update ) {
6667 for (total = cnt = 0 ; cnt < index -> cache_nr ; cnt ++ ) {
@@ -90,12 +91,13 @@ static void check_updates(struct unpack_trees_options *o)
9091 if (ce -> ce_flags & CE_UPDATE ) {
9192 ce -> ce_flags &= ~CE_UPDATE ;
9293 if (o -> update ) {
93- checkout_entry (ce , & state , NULL );
94+ errs |= checkout_entry (ce , & state , NULL );
9495 * last_symlink = '\0' ;
9596 }
9697 }
9798 }
9899 stop_progress (& progress );
100+ return errs != 0 ;
99101}
100102
101103static inline int call_unpack_fn (struct cache_entry * * src , struct unpack_trees_options * o )
@@ -369,7 +371,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
369371 return unpack_failed (o , "Merge requires file-level merging" );
370372
371373 o -> src_index = NULL ;
372- check_updates (o );
374+ if (check_updates (o ))
375+ return -1 ;
373376 if (o -> dst_index )
374377 * o -> dst_index = o -> result ;
375378 return 0 ;
0 commit comments