summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2010-04-06 14:50:46 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-04-06 14:50:46 -0700
commitf9bdf9b2102bd848c7a3eabff2ba5af63828de54 (patch)
tree4274aed1bdfa89d04b1d028520a95d83f69f4521
parentMerge branch 'sg/bash-completion' (diff)
parentrev-list: fix --pretty=oneline with empty message (diff)
downloadtgif-f9bdf9b2102bd848c7a3eabff2ba5af63828de54.tar.xz
Merge branch 'ef/maint-empty-commit-log'
* ef/maint-empty-commit-log: rev-list: fix --pretty=oneline with empty message
-rw-r--r--builtin/rev-list.c5
-rwxr-xr-xt/t6006-rev-list-format.sh9
2 files changed, 13 insertions, 1 deletions
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index eb8e2c2056..51ceb19d88 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -133,9 +133,12 @@ static void show_commit(struct commit *commit, void *data)
*/
if (graph_show_remainder(revs->graph))
putchar('\n');
+ if (revs->commit_format == CMIT_FMT_ONELINE)
+ putchar('\n');
}
} else {
- if (buf.len)
+ if (revs->commit_format != CMIT_FMT_USERFORMAT ||
+ buf.len)
printf("%s%c", buf.buf, info->hdr_termination);
}
strbuf_release(&buf);
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
index b0047d3c6b..d24ca5c077 100755
--- a/t/t6006-rev-list-format.sh
+++ b/t/t6006-rev-list-format.sh
@@ -209,4 +209,13 @@ test_expect_success '%gd shortens ref name' '
test_cmp expect.gd-short actual.gd-short
'
+test_expect_success 'oneline with empty message' '
+ git commit -m "dummy" --allow-empty &&
+ git commit -m "dummy" --allow-empty &&
+ git filter-branch --msg-filter "sed -e s/dummy//" HEAD^^.. &&
+ git rev-list --oneline HEAD > /tmp/test.txt &&
+ test $(git rev-list --oneline HEAD | wc -l) -eq 5 &&
+ test $(git rev-list --oneline --graph HEAD | wc -l) -eq 5
+'
+
test_done