@@ -452,8 +452,9 @@ static int same(struct cache_entry *a, struct cache_entry *b)
452452 * When a CE gets turned into an unmerged entry, we
453453 * want it to be up-to-date
454454 */
455- static int verify_uptodate (struct cache_entry * ce ,
456- struct unpack_trees_options * o )
455+ static int verify_uptodate_1 (struct cache_entry * ce ,
456+ struct unpack_trees_options * o ,
457+ const char * error_msg )
457458{
458459 struct stat st ;
459460
@@ -478,7 +479,13 @@ static int verify_uptodate(struct cache_entry *ce,
478479 if (errno == ENOENT )
479480 return 0 ;
480481 return o -> gently ? -1 :
481- error (ERRORMSG (o , not_uptodate_file ), ce -> name );
482+ error (error_msg , ce -> name );
483+ }
484+
485+ static int verify_uptodate (struct cache_entry * ce ,
486+ struct unpack_trees_options * o )
487+ {
488+ return verify_uptodate_1 (ce , o , ERRORMSG (o , not_uptodate_file ));
482489}
483490
484491static void invalidate_ce_path (struct cache_entry * ce , struct unpack_trees_options * o )
@@ -586,8 +593,9 @@ static int icase_exists(struct unpack_trees_options *o, struct cache_entry *dst,
586593 * We do not want to remove or overwrite a working tree file that
587594 * is not tracked, unless it is ignored.
588595 */
589- static int verify_absent (struct cache_entry * ce , const char * action ,
590- struct unpack_trees_options * o )
596+ static int verify_absent_1 (struct cache_entry * ce , const char * action ,
597+ struct unpack_trees_options * o ,
598+ const char * error_msg )
591599{
592600 struct stat st ;
593601
@@ -667,6 +675,11 @@ static int verify_absent(struct cache_entry *ce, const char *action,
667675 }
668676 return 0 ;
669677}
678+ static int verify_absent (struct cache_entry * ce , const char * action ,
679+ struct unpack_trees_options * o )
680+ {
681+ return verify_absent_1 (ce , action , o , ERRORMSG (o , would_lose_untracked ));
682+ }
670683
671684static int merged_entry (struct cache_entry * merge , struct cache_entry * old ,
672685 struct unpack_trees_options * o )
0 commit comments