1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-24 21:16:10 +02:00

git-svn: Fix git svn log --show-commit

git svn log --show-commit had no tests and, consequently, no attention
by the author of

b1b4755 (git-log: put space after commit mark, 2011-03-10)

who kept git svn log working only without --show-commit.

Introduce a test and fix it.

Reported-by: Bernt Hansen <bernt@norang.ca>
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Michael J Gruber 2011-05-20 13:16:34 +02:00 committed by Junio C Hamano
parent 3d5ae43527
commit 9963e025e8
2 changed files with 16 additions and 1 deletions

View File

@ -5752,7 +5752,7 @@ sub cmd_show_log {
my (@k, $c, $d, $stat);
my $esc_color = qr/(?:\033\[(?:(?:\d+;)*\d*)?m)*/;
while (<$log>) {
if (/^${esc_color}commit (- )?($::sha1_short)/o) {
if (/^${esc_color}commit (?:- )?($::sha1_short)/o) {
my $cmt = $1;
if ($c && cmt_showable($c) && $c->{r} != $r_last) {
$r_last = $c->{r};

View File

@ -60,6 +60,21 @@ test_expect_success 'test ascending revision range' "
git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -
"
test_expect_success 'test ascending revision range with --show-commit' "
git reset --hard trunk &&
git svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -
"
test_expect_success 'test ascending revision range with --show-commit (sha1)' "
git svn find-rev r1 >expected-range-r1-r2-r4-sha1 &&
git svn find-rev r2 >>expected-range-r1-r2-r4-sha1 &&
git svn find-rev r4 >>expected-range-r1-r2-r4-sha1 &&
git reset --hard trunk &&
git svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f2 >out &&
git rev-parse \$(cat out) >actual &&
test_cmp expected-range-r1-r2-r4-sha1 actual
"
printf 'r4 \nr2 \nr1 \n' > expected-range-r4-r2-r1
test_expect_success 'test descending revision range' "