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

[PATCH 1/3] git-svn log: fix ascending revision ranges

From
David D Kilzer <ddkilzer@kilzer.net>
Date
Nov 11, 2007, 06:10 UTC
Message-ID
<1194761435-7286-2-git-send-email-ddkilzer@kilzer.net>
In-Reply-To
<1194761435-7286-1-git-send-email-ddkilzer@kilzer.net>

Fixed typo in Git::SVN::Log::git_svn_log_cmd(). Previously a command like "git-svn log -r1:4" would only show a commit log separator.

Added tests for ascending and descending revision ranges.
Signed-off-by: David D Kilzer <ddkilzer@kilzer.net>
---
 git-svn.perl           |    2 +-
 t/t9116-git-svn-log.sh |   14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index ec25ea4..3c5a87d 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3591,7 +3591,7 @@ sub git_svn_log_cmd {
 		$c_max = $gs->rev_db_get($r_max);
 		$c_min = $gs->rev_db_get($r_min);
 		if (defined $c_min && defined $c_max) {
-			if ($r_max > $r_max) {
+			if ($r_max > $r_min) {
 				push @cmd, "$c_min..$c_max";
 			} else {
 				push @cmd, "$c_max..$c_min";
diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh
index 0d4e6b3..618d7e9 100755
--- a/t/t9116-git-svn-log.sh
+++ b/t/t9116-git-svn-log.sh
@@ -45,4 +45,18 @@ test_expect_success 'run log against a from trunk' "
 	git svn log -r3 a | grep ^r3
 	"
 
+printf 'r2 \nr4 \n' > expected-range-r2-r4
+
+test_expect_success 'test ascending revision range' "
+	git reset --hard trunk &&
+	git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r2-r4 -
+	"
+
+printf 'r4 \nr2 \n' > expected-range-r4-r2
+
+test_expect_success 'test descending revision range' "
+	git reset --hard trunk &&
+	git svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4-r2 -
+	"
+
 test_done
-- 
1.5.3.4
Previous: David D KilzerNext: David D Kilzer
Message 2 of 11 in “git-svn log fixes”
  1. 0/3 git-svn log fixesDavid D Kilzer, Nov 11, 2007
  2. 1/3 git-svn log: fix ascending revision rangesDavid D Kilzer, Nov 11, 2007
  3. 2/3 git-svn log: include commit log for the smallest revision in a rangeDavid D Kilzer, Nov 11, 2007
  4. 3/3 git-svn log: handle unreachable revisions like "svn log"David D Kilzer, Nov 11, 2007
  5. Benoit SigoureNov 11, 2007
  6. David D. KilzerNov 11, 2007
  7. Benoit SigoureNov 11, 2007
  8. Eric WongNov 12, 2007
  9. 3/3 git-svn log: handle unreachable revisions like "svn log"David D Kilzer, Nov 12, 2007
  10. Eric WongNov 17, 2007
  11. Junio C HamanoNov 18, 2007

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.