@@ -92,8 +92,9 @@ N_("If you wish to skip this commit, use:\n"
92
92
"Then \"git cherry-pick --continue\" will resume cherry-picking\n"
93
93
"the remaining commits.\n" );
94
94
95
+ static GIT_PATH_FUNC (git_path_commit_editmsg , "COMMIT_EDITMSG ")
96
+
95
97
static const char * use_message_buffer ;
96
- static const char commit_editmsg [] = "COMMIT_EDITMSG" ;
97
98
static struct lock_file index_lock ; /* real index */
98
99
static struct lock_file false_lock ; /* used only for partial commits */
99
100
static enum {
@@ -772,9 +773,9 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
772
773
hook_arg2 = "" ;
773
774
}
774
775
775
- s -> fp = fopen_for_writing (git_path ( commit_editmsg ));
776
+ s -> fp = fopen_for_writing (git_path_commit_editmsg ( ));
776
777
if (s -> fp == NULL )
777
- die_errno (_ ("could not open '%s'" ), git_path ( commit_editmsg ));
778
+ die_errno (_ ("could not open '%s'" ), git_path_commit_editmsg ( ));
778
779
779
780
/* Ignore status.displayCommentPrefix: we do need comments in COMMIT_EDITMSG. */
780
781
old_display_comment_prefix = s -> display_comment_prefix ;
@@ -951,23 +952,23 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
951
952
}
952
953
953
954
if (run_commit_hook (use_editor , index_file , "prepare-commit-msg" ,
954
- git_path ( commit_editmsg ), hook_arg1 , hook_arg2 , NULL ))
955
+ git_path_commit_editmsg ( ), hook_arg1 , hook_arg2 , NULL ))
955
956
return 0 ;
956
957
957
958
if (use_editor ) {
958
959
char index [PATH_MAX ];
959
960
const char * env [2 ] = { NULL };
960
961
env [0 ] = index ;
961
962
snprintf (index , sizeof (index ), "GIT_INDEX_FILE=%s" , index_file );
962
- if (launch_editor (git_path ( commit_editmsg ), NULL , env )) {
963
+ if (launch_editor (git_path_commit_editmsg ( ), NULL , env )) {
963
964
fprintf (stderr ,
964
965
_ ("Please supply the message using either -m or -F option.\n" ));
965
966
exit (1 );
966
967
}
967
968
}
968
969
969
970
if (!no_verify &&
970
- run_commit_hook (use_editor , index_file , "commit-msg" , git_path ( commit_editmsg ), NULL )) {
971
+ run_commit_hook (use_editor , index_file , "commit-msg" , git_path_commit_editmsg ( ), NULL )) {
971
972
return 0 ;
972
973
}
973
974
@@ -1738,7 +1739,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
1738
1739
1739
1740
/* Finally, get the commit message */
1740
1741
strbuf_reset (& sb );
1741
- if (strbuf_read_file (& sb , git_path ( commit_editmsg ), 0 ) < 0 ) {
1742
+ if (strbuf_read_file (& sb , git_path_commit_editmsg ( ), 0 ) < 0 ) {
1742
1743
int saved_errno = errno ;
1743
1744
rollback_index_files ();
1744
1745
die (_ ("could not read commit message: %s" ), strerror (saved_errno ));
0 commit comments