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

[PATCH 3/9] git-svn: Allow for more argument types for commit (from..to)

From
EWEric Wong <normalperson@yhbt.net>
Date
Feb 20, 2006, 18:57 UTC
Message-ID
<1140461846433-git-send-email-normalperson@yhbt.net>
In-Reply-To
<11404618464102-git-send-email-normalperson@yhbt.net>
Allow 'from..to' notation from the command line.

More liberal sha1 parsing when reading from stdin no longer requires the sha1 to be the first character, so a leading 'commit ' string is OK.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 contrib/git-svn/git-svn     |   13 ++++++++++---
 contrib/git-svn/git-svn.txt |    2 +-
 2 files changed, 11 insertions(+), 4 deletions(-)
4d8326c4868461e8a48a4e25ef11ece6e9f92843
diff --git a/contrib/git-svn/git-svn b/contrib/git-svn/git-svn
index 477ec16..5f23d6b 100755
--- a/contrib/git-svn/git-svn
+++ b/contrib/git-svn/git-svn
@@ -216,14 +216,21 @@ sub commit {
 		print "Reading from stdin...\n";
 		@commits = ();
 		while (<STDIN>) {
-			if (/^([a-f\d]{6,40})\b/) {
+			if (/\b([a-f\d]{6,40})\b/) {
 				unshift @commits, $1;
 			}
 		}
 	}
 	my @revs;
-	foreach (@commits) {
-		push @revs, (safe_qx('git-rev-parse',$_));
+	foreach my $c (@commits) {
+		chomp(my @tmp = safe_qx('git-rev-parse',$c));
+		if (scalar @tmp == 1) {
+			push @revs, $tmp[0];
+		} elsif (scalar @tmp > 1) {
+			push @revs, reverse (safe_qx('git-rev-list',@tmp));
+		} else {
+			die "Failed to rev-parse $c\n";
+		}
 	}
 	chomp @revs;
 
diff --git a/contrib/git-svn/git-svn.txt b/contrib/git-svn/git-svn.txt
index 9912f5a..07a236f 100644
--- a/contrib/git-svn/git-svn.txt
+++ b/contrib/git-svn/git-svn.txt
@@ -149,7 +149,7 @@ Tracking and contributing to an Subversi
 # Commit only the git commits you want to SVN::
 	git-svn commit <tree-ish> [<tree-ish_2> ...]
 # Commit all the git commits from my-branch that don't exist in SVN::
-	git rev-list --pretty=oneline git-svn-HEAD..my-branch | git-svn commit
+	git commit git-svn-HEAD..my-branch
 # Something is committed to SVN, pull the latest into your branch::
 	git-svn fetch && git pull . git-svn-HEAD
 
-- 
1.2.0.gdee6
Previous: Eric Wong
Message 4 of 4 in “git-svn: nearing 1.0.0”
  1. Eric WongFeb 20, 2006
  2. 1/9 git-svn: fix a typo in defining the --no-stop-on-copy optionEric Wong, Feb 20, 2006
  3. 2/9 git-svn: allow --find-copies-harder and -l<num> to be passed on commitEric Wong, Feb 20, 2006
  4. 3/9 git-svn: Allow for more argument types for commit (from..to)Eric Wong, Feb 20, 2006

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.