diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-07-09 11:34:05 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-07-09 11:34:05 -0700 |
commit | 3b8e8af187cb86ed030432f1a067121fdd4b1c3b (patch) | |
tree | dd8cdaa18cfd70d6cfe6b0a3120fccb5f0a971cd /builtin/name-rev.c | |
parent | Merge branch 'jk/skip-prefix' (diff) | |
parent | setup_git_env(): introduce git_path_from_env() helper (diff) | |
download | tgif-3b8e8af187cb86ed030432f1a067121fdd4b1c3b.tar.xz |
Merge branch 'jk/xstrfmt'
* jk/xstrfmt:
setup_git_env(): introduce git_path_from_env() helper
unique_path: fix unlikely heap overflow
walker_fetch: fix minor memory leak
merge: use argv_array when spawning merge strategy
sequencer: use argv_array_pushf
setup_git_env: use git_pathdup instead of xmalloc + sprintf
use xstrfmt to replace xmalloc + strcpy/strcat
use xstrfmt to replace xmalloc + sprintf
use xstrdup instead of xmalloc + strcpy
use xstrfmt in favor of manual size calculations
strbuf: add xstrfmt helper
Diffstat (limited to 'builtin/name-rev.c')
-rw-r--r-- | builtin/name-rev.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/builtin/name-rev.c b/builtin/name-rev.c index c824d4ec5f..3c8f319be6 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -33,10 +33,7 @@ static void name_rev(struct commit *commit, return; if (deref) { - char *new_name = xmalloc(strlen(tip_name)+3); - strcpy(new_name, tip_name); - strcat(new_name, "^0"); - tip_name = new_name; + tip_name = xstrfmt("%s^0", tip_name); if (generation) die("generation: %d, but deref?", generation); |