@@ -231,9 +231,9 @@ static struct option builtin_merge_options[] = {
231231/* Cleans up metadata that is uninteresting after a succeeded merge. */
232232static void drop_save (void )
233233{
234- unlink (git_path ( "MERGE_HEAD" ));
235- unlink (git_path ( "MERGE_MSG" ));
236- unlink (git_path ( "MERGE_MODE" ));
234+ unlink (git_path_merge_head ( ));
235+ unlink (git_path_merge_msg ( ));
236+ unlink (git_path_merge_mode ( ));
237237}
238238
239239static int save_state (unsigned char * stash )
@@ -338,7 +338,7 @@ static void squash_message(struct commit *commit, struct commit_list *remotehead
338338 struct pretty_print_context ctx = {0 };
339339
340340 printf (_ ("Squash commit -- not updating HEAD\n" ));
341- filename = git_path ( "SQUASH_MSG" );
341+ filename = git_path_squash_msg ( );
342342 fd = open (filename , O_WRONLY | O_CREAT , 0666 );
343343 if (fd < 0 )
344344 die_errno (_ ("Could not write to '%s'" ), filename );
@@ -754,7 +754,7 @@ static void add_strategies(const char *string, unsigned attr)
754754
755755static void write_merge_msg (struct strbuf * msg )
756756{
757- const char * filename = git_path ( "MERGE_MSG" );
757+ const char * filename = git_path_merge_msg ( );
758758 int fd = open (filename , O_WRONLY | O_CREAT , 0666 );
759759 if (fd < 0 )
760760 die_errno (_ ("Could not open '%s' for writing" ),
@@ -766,7 +766,7 @@ static void write_merge_msg(struct strbuf *msg)
766766
767767static void read_merge_msg (struct strbuf * msg )
768768{
769- const char * filename = git_path ( "MERGE_MSG" );
769+ const char * filename = git_path_merge_msg ( );
770770 strbuf_reset (msg );
771771 if (strbuf_read_file (msg , filename , 0 ) < 0 )
772772 die_errno (_ ("Could not read from '%s'" ), filename );
@@ -799,10 +799,10 @@ static void prepare_to_commit(struct commit_list *remoteheads)
799799 strbuf_commented_addf (& msg , _ (merge_editor_comment ), comment_line_char );
800800 write_merge_msg (& msg );
801801 if (run_commit_hook (0 < option_edit , get_index_file (), "prepare-commit-msg" ,
802- git_path ( "MERGE_MSG" ), "merge" , NULL ))
802+ git_path_merge_msg ( ), "merge" , NULL ))
803803 abort_commit (remoteheads , NULL );
804804 if (0 < option_edit ) {
805- if (launch_editor (git_path ( "MERGE_MSG" ), NULL , NULL ))
805+ if (launch_editor (git_path_merge_msg ( ), NULL , NULL ))
806806 abort_commit (remoteheads , NULL );
807807 }
808808 read_merge_msg (& msg );
@@ -865,7 +865,7 @@ static int suggest_conflicts(void)
865865 FILE * fp ;
866866 struct strbuf msgbuf = STRBUF_INIT ;
867867
868- filename = git_path ( "MERGE_MSG" );
868+ filename = git_path_merge_msg ( );
869869 fp = fopen (filename , "a" );
870870 if (!fp )
871871 die_errno (_ ("Could not open '%s' for writing" ), filename );
@@ -967,7 +967,7 @@ static void write_merge_state(struct commit_list *remoteheads)
967967 }
968968 strbuf_addf (& buf , "%s\n" , sha1_to_hex (sha1 ));
969969 }
970- filename = git_path ( "MERGE_HEAD" );
970+ filename = git_path_merge_head ( );
971971 fd = open (filename , O_WRONLY | O_CREAT , 0666 );
972972 if (fd < 0 )
973973 die_errno (_ ("Could not open '%s' for writing" ), filename );
@@ -977,7 +977,7 @@ static void write_merge_state(struct commit_list *remoteheads)
977977 strbuf_addch (& merge_msg , '\n' );
978978 write_merge_msg (& merge_msg );
979979
980- filename = git_path ( "MERGE_MODE" );
980+ filename = git_path_merge_mode ( );
981981 fd = open (filename , O_WRONLY | O_CREAT | O_TRUNC , 0666 );
982982 if (fd < 0 )
983983 die_errno (_ ("Could not open '%s' for writing" ), filename );
@@ -1070,7 +1070,7 @@ static void handle_fetch_head(struct commit_list **remotes, struct strbuf *merge
10701070 if (!merge_names )
10711071 merge_names = & fetch_head_file ;
10721072
1073- filename = git_path ( "FETCH_HEAD" );
1073+ filename = git_path_fetch_head ( );
10741074 fd = open (filename , O_RDONLY );
10751075 if (fd < 0 )
10761076 die_errno (_ ("could not open '%s' for reading" ), filename );
@@ -1204,7 +1204,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
12041204 int nargc = 2 ;
12051205 const char * nargv [] = {"reset" , "--merge" , NULL };
12061206
1207- if (!file_exists (git_path ( "MERGE_HEAD" )))
1207+ if (!file_exists (git_path_merge_head ( )))
12081208 die (_ ("There is no merge to abort (MERGE_HEAD missing)." ));
12091209
12101210 /* Invoke 'git reset --merge' */
@@ -1215,7 +1215,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
12151215 if (read_cache_unmerged ())
12161216 die_resolve_conflict ("merge" );
12171217
1218- if (file_exists (git_path ( "MERGE_HEAD" ))) {
1218+ if (file_exists (git_path_merge_head ( ))) {
12191219 /*
12201220 * There is no unmerged entry, don't advise 'git
12211221 * add/rm <file>', just 'git commit'.
@@ -1226,7 +1226,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
12261226 else
12271227 die (_ ("You have not concluded your merge (MERGE_HEAD exists)." ));
12281228 }
1229- if (file_exists (git_path ( "CHERRY_PICK_HEAD" ))) {
1229+ if (file_exists (git_path_cherry_pick_head ( ))) {
12301230 if (advice_resolve_conflict )
12311231 die (_ ("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).\n"
12321232 "Please, commit your changes before you merge." ));
0 commit comments