Code

Merge branch 'ar/maint-mksnpath' into maint
authorJunio C Hamano <gitster@pobox.com>
Sun, 9 Nov 2008 00:13:19 +0000 (16:13 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sun, 9 Nov 2008 00:13:19 +0000 (16:13 -0800)
* 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

1  2 
builtin-revert.c
builtin-tag.c
cache.h
path.c
refs.c
rerere.c

index 786a956f26486856c97e15ce8ab464dfb25dcbc5,5c4ab58f4643b8a1b77507c1cc0f0b8a70691ebf..74845ef8e6f9c635bbafbf5dfea5e73cf6e11aa0
@@@ -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 builtin-tag.c
Simple merge
diff --cc cache.h
Simple merge
diff --cc path.c
Simple merge
diff --cc refs.c
Simple merge
diff --cc rerere.c
index 2b7a99d729e13b09239f1d9175d3d6c0048821b0,3d6ee8fa2a647d6ee8459f700cbc450c94e7f179..a0d477aaca73ff7ec8b12dc6c8255b69dbd677a5
+++ 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;
  }