git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Eric Wong <normalperson@yhbt.net>, Bernt Hansen <bernt@norang.ca>
Subject: [PATCH maint] git-svn: Fix git svn log --show-commit
Date: Fri, 20 May 2011 09:49:12 +0200	[thread overview]
Message-ID: <a9a8802cb8efa509991f7430ed7591d0b3946e88.1305877679.git.git@drmicha.warpmail.net> (raw)
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!

The fix replaces a group "(- )?" by "-? ?" which works in this
case (though not being equivalent). It's easier than dealing
with the problem the grouping introduced.
---
 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..b1eef85 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -5734,7 +5734,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};
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

       reply	other threads:[~2011-05-20  7:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87y622doa7.fsf@norang.ca>
2011-05-20  7:49 ` Michael J Gruber [this message]
2011-05-20 20:26   ` [PATCH maint] git-svn: Fix git svn log --show-commit Andreas Schwab
2011-05-20 11:16 ` [PATCHv2 " Michael J Gruber
2011-05-20 11:48   ` Bernt Hansen
2011-05-20 16:17   ` Junio C Hamano
2011-05-21  9:30     ` Michael J Gruber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a9a8802cb8efa509991f7430ed7591d0b3946e88.1305877679.git.git@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=bernt@norang.ca \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=normalperson@yhbt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).