diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-06-22 23:32:19 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-06-22 23:32:19 -0700 |
commit | 9bee7aabcd74bf112fcdaf255551147feca8f66c (patch) | |
tree | 7e880ce1ba6dc9e59a30fdc1cbdc0f3e8b0992e3 /builtin-branch.c | |
parent | 55f22ff22e5ff6c21b50cf379ee946f9642fc3cb (diff) | |
parent | 25fd2f7a310df17dca298a3acf2aba716ceb8ce3 (diff) | |
download | git-9bee7aabcd74bf112fcdaf255551147feca8f66c.tar.gz |
Merge branch 'ei/oneline+add-empty'
* ei/oneline+add-empty:
Fix ALLOC_GROW calls with obsolete semantics
Fix ALLOC_GROW off-by-one
builtin-add: simplify (and increase accuracy of) exclude handling
dir_struct: add collect_ignored option
Extend --pretty=oneline to cover the first paragraph,
Lift 16kB limit of log message output
Diffstat (limited to 'builtin-branch.c')
-rw-r--r-- | builtin-branch.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/builtin-branch.c b/builtin-branch.c index bd4748f845..77b85dde1f 100644 --- a/builtin-branch.c +++ b/builtin-branch.c @@ -247,7 +247,6 @@ static void print_ref_item(struct ref_item *item, int maxwidth, int verbose, char c; int color; struct commit *commit; - char subject[256]; switch (item->kind) { case REF_LOCAL_BRANCH: @@ -268,17 +267,23 @@ static void print_ref_item(struct ref_item *item, int maxwidth, int verbose, } if (verbose) { + char *subject = NULL; + unsigned long subject_len = 0; + const char *sub = " **** invalid ref ****"; + commit = lookup_commit(item->sha1); - if (commit && !parse_commit(commit)) + if (commit && !parse_commit(commit)) { pretty_print_commit(CMIT_FMT_ONELINE, commit, ~0, - subject, sizeof(subject), 0, + &subject, &subject_len, 0, NULL, NULL, 0); - else - strcpy(subject, " **** invalid ref ****"); + sub = subject; + } printf("%c %s%-*s%s %s %s\n", c, branch_get_color(color), maxwidth, item->name, branch_get_color(COLOR_BRANCH_RESET), - find_unique_abbrev(item->sha1, abbrev), subject); + find_unique_abbrev(item->sha1, abbrev), sub); + if (subject) + free(subject); } else { printf("%c %s%s%s\n", c, branch_get_color(color), item->name, branch_get_color(COLOR_BRANCH_RESET)); |