git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCHv2 maint] git-svn: Fix git svn log --show-commit

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
May 20, 2011, 11:16 UTC
Message-ID
<3dd919897d4a5eca34f421457cc8da461574ee78.1305890184.git.git@drmicha.warpmail.net>
In-Reply-To
<87y622doa7.fsf@norang.ca>

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>
---
git svn scares me. It exits with 0 even with these problems!
Consequently, the tests in t9116 completely ignore the return codes
because of the pipes.
Patch directly on top of b1b4755. Thanks for the report!
v2 uses the grouped regexp again. I've learned to count to 2 meanwhile.
---
 git-svn.perl           |    2 +-
 t/t9116-git-svn-log.sh |   15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index a5857c1..0cee0e9 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -5735,7 +5735,7 @@ sub cmd_show_log {
 	my $esc_color = qr/(?:\033\[(?:(?:\d+;)*\d*)?m)*/;
 	while (<$log>) {
 		if (/^${esc_color}commit (- )?($::sha1_short)/o) {
-			my $cmt = $1;
+			my $cmt = $2;
 			if ($c && cmt_showable($c) && $c->{r} != $r_last) {
 				$r_last = $c->{r};
 				process_commit($c, $r_min, $r_max, \@k) or
diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh
index 5d477e4..cf4c052 100755
--- a/t/t9116-git-svn-log.sh
+++ b/t/t9116-git-svn-log.sh
@@ -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' "
-- 
1.7.5.1.558.gc8bec
Previous: Andreas SchwabNext: Bernt Hansen
Message 3 of 6 in “git-svn: Fix git svn log --show-commit”
  1. git-svn: Fix git svn log --show-commitMichael J Gruber, May 20, 2011
  2. Andreas SchwabMay 20, 2011
  3. [PATCHv2 maint] git-svn: Fix git svn log --show-commitMichael J Gruber, May 20, 2011
  4. [PATCHv2 maint] git-svn: Fix git svn log --show-commitBernt Hansen, May 20, 2011
  5. Junio C HamanoMay 20, 2011
  6. Michael J GruberMay 21, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.