diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-03-16 16:59:30 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-03-16 16:59:30 -0700 |
commit | b2f6eab4027beaaa7415e70dad269bdc7cc27722 (patch) | |
tree | 2e6088ca17b4042ccf9c658148cd5af55021c8a1 /builtin/log.c | |
parent | 06316234accdcb6608506aed6600cd60ff5c5c8e (diff) | |
parent | fbcda3c0a72cbcc105100ebef1b1dae54d854204 (diff) | |
download | git-b2f6eab4027beaaa7415e70dad269bdc7cc27722.tar.gz git-b2f6eab4027beaaa7415e70dad269bdc7cc27722.tar.xz |
Merge branch 'maint'
* maint:
Prepare draft release notes to 1.7.4.2
gitweb: highlight: replace tabs with spaces
make_absolute_path: return the input path if it points to our buffer
valgrind: ignore SSE-based strlen invalid reads
diff --submodule: split into bite-sized pieces
cherry: split off function to print output lines
branch: split off function that writes tracking info and commit subject
standardize brace placement in struct definitions
compat: make gcc bswap an inline function
enums: omit trailing comma for portability
Conflicts:
RelNotes
Diffstat (limited to 'builtin/log.c')
-rw-r--r-- | builtin/log.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/builtin/log.c b/builtin/log.c index f5ed690c4..99e33b365 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1352,6 +1352,23 @@ static const char * const cherry_usage[] = { NULL }; +static void print_commit(char sign, struct commit *commit, int verbose, + int abbrev) +{ + if (!verbose) { + printf("%c %s\n", sign, + find_unique_abbrev(commit->object.sha1, abbrev)); + } else { + struct strbuf buf = STRBUF_INIT; + struct pretty_print_context ctx = {0}; + pretty_print_commit(CMIT_FMT_ONELINE, commit, &buf, &ctx); + printf("%c %s %s\n", sign, + find_unique_abbrev(commit->object.sha1, abbrev), + buf.buf); + strbuf_release(&buf); + } +} + int cmd_cherry(int argc, const char **argv, const char *prefix) { struct rev_info revs; @@ -1436,22 +1453,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix) commit = list->item; if (has_commit_patch_id(commit, &ids)) sign = '-'; - - if (verbose) { - struct strbuf buf = STRBUF_INIT; - struct pretty_print_context ctx = {0}; - pretty_print_commit(CMIT_FMT_ONELINE, commit, - &buf, &ctx); - printf("%c %s %s\n", sign, - find_unique_abbrev(commit->object.sha1, abbrev), - buf.buf); - strbuf_release(&buf); - } - else { - printf("%c %s\n", sign, - find_unique_abbrev(commit->object.sha1, abbrev)); - } - + print_commit(sign, commit, verbose, abbrev); list = list->next; } |