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>

Michael J Gruber committed May 20, 2011 at 13:16 UTC 9963e025e88f134cf07ef348d80a5821c69a7eb0
2 files changed +16 -1
git-svn.perl
+1 -1
@@ -5752,7 +5752,7 @@ sub cmd_show_log {
5752 my (@k, $c, $d, $stat);
5753 my $esc_color = qr/(?:\033\[(?:(?:\d+;)*\d*)?m)*/;
5754 while (<$log>) {
5755 - if (/^${esc_color}commit (- )?($::sha1_short)/o) {
5755 + if (/^${esc_color}commit (?:- )?($::sha1_short)/o) {
5756 my $cmt = $1;
5757 if ($c && cmt_showable($c) && $c->{r} != $r_last) {
5758 $r_last = $c->{r};
t/t9116-git-svn-log.sh
+15
@@ -60,6 +60,21 @@ test_expect_success 'test ascending revision range' "
60 git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -
61 "
62
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 +
78 printf 'r4 \nr2 \nr1 \n' > expected-range-r4-r2-r1
79
80 test_expect_success 'test descending revision range' "