use git_path_* helper functions
Long ago we added functions like git_path_merge_msg() to replace the more dangerous git_path("MERGE_MSG"). Over time some new calls to the latter have crept it. Let's convert them to use the safer form. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
c10388c7dc
commit
ca03e0670c
|
@ -821,9 +821,9 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
|
|||
"If this is not correct, please remove the file\n"
|
||||
" %s\n"
|
||||
"and try again.\n"),
|
||||
git_path(whence == FROM_MERGE
|
||||
? "MERGE_HEAD"
|
||||
: "CHERRY_PICK_HEAD"));
|
||||
whence == FROM_MERGE ?
|
||||
git_path_merge_head() :
|
||||
git_path_cherry_pick_head());
|
||||
}
|
||||
|
||||
fprintf(s->fp, "\n");
|
||||
|
|
|
@ -332,7 +332,7 @@ static int git_pull_config(const char *var, const char *value, void *cb)
|
|||
*/
|
||||
static void get_merge_heads(struct sha1_array *merge_heads)
|
||||
{
|
||||
const char *filename = git_path("FETCH_HEAD");
|
||||
const char *filename = git_path_fetch_head();
|
||||
FILE *fp;
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
unsigned char sha1[GIT_SHA1_RAWSZ];
|
||||
|
@ -791,7 +791,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
|
|||
if (read_cache_unmerged())
|
||||
die_resolve_conflict("pull");
|
||||
|
||||
if (file_exists(git_path("MERGE_HEAD")))
|
||||
if (file_exists(git_path_merge_head()))
|
||||
die_conclude_merge();
|
||||
|
||||
if (get_sha1("HEAD", orig_head))
|
||||
|
|
12
sequencer.c
12
sequencer.c
|
@ -1057,12 +1057,12 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
|
|||
cleanup_commit_message = 1;
|
||||
msg_file = rebase_path_fixup_msg();
|
||||
} else {
|
||||
const char *dest = git_path("SQUASH_MSG");
|
||||
const char *dest = git_path_squash_msg();
|
||||
unlink(dest);
|
||||
if (copy_file(dest, rebase_path_squash_msg(), 0666))
|
||||
return error(_("could not rename '%s' to '%s'"),
|
||||
rebase_path_squash_msg(), dest);
|
||||
unlink(git_path("MERGE_MSG"));
|
||||
unlink(git_path_merge_msg());
|
||||
msg_file = dest;
|
||||
edit = 1;
|
||||
}
|
||||
|
@ -1812,10 +1812,10 @@ static int error_failed_squash(struct commit *commit,
|
|||
return error(_("could not rename '%s' to '%s'"),
|
||||
rebase_path_squash_msg(), rebase_path_message());
|
||||
unlink(rebase_path_fixup_msg());
|
||||
unlink(git_path("MERGE_MSG"));
|
||||
if (copy_file(git_path("MERGE_MSG"), rebase_path_message(), 0666))
|
||||
unlink(git_path_merge_msg());
|
||||
if (copy_file(git_path_merge_msg(), rebase_path_message(), 0666))
|
||||
return error(_("could not copy '%s' to '%s'"),
|
||||
rebase_path_message(), git_path("MERGE_MSG"));
|
||||
rebase_path_message(), git_path_merge_msg());
|
||||
return error_with_patch(commit, subject, subject_len, opts, 1, 0);
|
||||
}
|
||||
|
||||
|
@ -2158,7 +2158,7 @@ static int commit_staged_changes(struct replay_opts *opts)
|
|||
if (has_unstaged_changes(1))
|
||||
return error(_("cannot rebase: You have unstaged changes."));
|
||||
if (!has_uncommitted_changes(0)) {
|
||||
const char *cherry_pick_head = git_path("CHERRY_PICK_HEAD");
|
||||
const char *cherry_pick_head = git_path_cherry_pick_head();
|
||||
|
||||
if (file_exists(cherry_pick_head) && unlink(cherry_pick_head))
|
||||
return error(_("could not remove CHERRY_PICK_HEAD"));
|
||||
|
|
Loading…
Reference in New Issue