From: Junio C Hamano Date: Sun, 9 Nov 2008 00:13:19 +0000 (-0800) Subject: Merge branch 'ar/maint-mksnpath' into maint X-Git-Tag: v1.6.0.4~4 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8b1981d32b41f1b4e26d8d96a3c6e63b9bc746b0;p=git.git Merge branch 'ar/maint-mksnpath' into maint * ar/maint-mksnpath: Use git_pathdup instead of xstrdup(git_path(...)) git_pathdup: returns xstrdup-ed copy of the formatted path Fix potentially dangerous use of git_path in ref.c Add git_snpath: a .git path formatting routine with output buffer Fix potentially dangerous uses of mkpath and git_path Fix mkpath abuse in dwim_ref and dwim_log of sha1_name.c Add mksnpath which allows you to specify the output buffer Conflicts: builtin-revert.c rerere.c --- 8b1981d32b41f1b4e26d8d96a3c6e63b9bc746b0 diff --cc builtin-revert.c index 786a956f2,5c4ab58f4..74845ef8e --- a/builtin-revert.c +++ b/builtin-revert.c @@@ -269,7 -269,7 +269,7 @@@ static int revert_or_cherry_pick(int ar int i; char *oneline, *reencoded_message = NULL; const char *message, *encoding; - char *defmsg = xstrdup(git_path("MERGE_MSG")); - const char *defmsg = git_pathdup("MERGE_MSG"); ++ char *defmsg = git_pathdup("MERGE_MSG"); git_config(git_default_config, NULL); me = action == REVERT ? "revert" : "cherry-pick"; diff --cc rerere.c index 2b7a99d72,3d6ee8fa2..a0d477aac --- a/rerere.c +++ b/rerere.c @@@ -345,9 -345,8 +345,9 @@@ int setup_rerere(struct string_list *me if (!is_rerere_enabled()) return -1; - merge_rr_path = xstrdup(git_path("MERGE_RR")); + merge_rr_path = git_pathdup("MERGE_RR"); - fd = hold_lock_file_for_update(&write_lock, merge_rr_path, 1); + fd = hold_lock_file_for_update(&write_lock, merge_rr_path, + LOCK_DIE_ON_ERROR); read_rr(merge_rr); return fd; }