Skip to content

Commit

Permalink
Merge branch 'ef/maint-empty-commit-log' into maint
Browse files Browse the repository at this point in the history
* ef/maint-empty-commit-log:
  rev-list: fix --pretty=oneline with empty message
  • Loading branch information
Junio C Hamano committed Apr 10, 2010
2 parents daaf2e8 + 1fb5fdd commit 408dee5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion builtin-rev-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 9 additions & 0 deletions t/t6006-rev-list-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 408dee5

Please sign in to comment.