Skip to content

Commit 9963e02

Browse files
Michael J Grubergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Michael J Gruber <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3d5ae43 commit 9963e02

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

git-svn.perl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5752,7 +5752,7 @@ sub cmd_show_log {
57525752
my (@k, $c, $d, $stat);
57535753
my $esc_color = qr/(?:\033\[(?:(?:\d+;)*\d*)?m)*/;
57545754
while (<$log>) {
5755-
if (/^${esc_color}commit (- )?($::sha1_short)/o) {
5755+
if (/^${esc_color}commit (?:- )?($::sha1_short)/o) {
57565756
my $cmt = $1;
57575757
if ($c && cmt_showable($c) && $c->{r} != $r_last) {
57585758
$r_last = $c->{r};

t/t9116-git-svn-log.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,21 @@ test_expect_success 'test ascending revision range' "
6060
git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -
6161
"
6262

63+
test_expect_success 'test ascending revision range with --show-commit' "
64+
git reset --hard trunk &&
65+
git svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -
66+
"
67+
68+
test_expect_success 'test ascending revision range with --show-commit (sha1)' "
69+
git svn find-rev r1 >expected-range-r1-r2-r4-sha1 &&
70+
git svn find-rev r2 >>expected-range-r1-r2-r4-sha1 &&
71+
git svn find-rev r4 >>expected-range-r1-r2-r4-sha1 &&
72+
git reset --hard trunk &&
73+
git svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f2 >out &&
74+
git rev-parse \$(cat out) >actual &&
75+
test_cmp expected-range-r1-r2-r4-sha1 actual
76+
"
77+
6378
printf 'r4 \nr2 \nr1 \n' > expected-range-r4-r2-r1
6479

6580
test_expect_success 'test descending revision range' "

0 commit comments

Comments
 (0)