# [PATCH 1/9] git-svn: fix a typo in defining the --no-stop-on-copy option

4 messages from 2006-02-20 to 2006-02-20. Participants: Eric Wong.
Thread: https://gitlist.dev/t/3406

## Eric Wong, 2006-02-20 18:57

Subject: [PATCH 1/9] git-svn: fix a typo in defining the --no-stop-on-copy option
Message-ID: <11404618452729-git-send-email-normalperson@yhbt.net>
URL: https://gitlist.dev/e/11404618452729-git-send-email-normalperson%40yhbt.net
In-Reply-To: <11404618453236-git-send-email-normalperson@yhbt.net>

```
Just a typo, I doubt anybody would use (and I highly recommend not
using) this option anyways.  But you never know...

Signed-off-by: Eric Wong <normalperson@yhbt.net>

---

 contrib/git-svn/git-svn |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

7292b0320d5aab4f335b7c1198b77231bf78d44a
diff --git a/contrib/git-svn/git-svn b/contrib/git-svn/git-svn
index 71a8b3b..1a8f40e 100755
--- a/contrib/git-svn/git-svn
+++ b/contrib/git-svn/git-svn
@@ -38,7 +38,7 @@ GetOptions(	'revision|r=s' => \$_revisio
 		'edit|e' => \$_edit,
 		'rmdir' => \$_rmdir,
 		'help|H|h' => \$_help,
-		'no-stop-copy' => \$_no_stop_copy );
+		'no-stop-on-copy' => \$_no_stop_copy );
 my %cmd = (
 	fetch => [ \&fetch, "Download new revisions from SVN" ],
 	init => [ \&init, "Initialize and fetch (import)"],
-- 
1.2.0.gdee6

```

## Eric Wong, 2006-02-20 18:57

Subject: git-svn: nearing 1.0.0
Message-ID: <11404618453236-git-send-email-normalperson@yhbt.net>
URL: https://gitlist.dev/e/11404618453236-git-send-email-normalperson%40yhbt.net

```
      
This should hopefully be the last set of bugfixes I have for git-svn.  I'm
pretty satisfied with it, as I haven't needed to directly invoke svn and wait
for it in any of my day-to-day operations for doing work on svn repositories.

Most of the major changes are in 'commit' functionality where several
corner-case bugs have been found and fixed.

      git-svn: fix a typo in defining the --no-stop-on-copy option
      git-svn: allow --find-copies-harder and -l<num> to be passed on commit
      git-svn: Allow for more argument types for commit (from..to)
      git-svn: remove any need for the XML::Simple dependency
      git-svn: change ; to && in addremove()
      contrib/git-svn.txt: add a note about renamed/copied directory support
      git-svn: fix several corner-case and rare bugs with 'commit'
      contrib/git-svn: add Makefile, test, and associated ignores
      git-svn: 0.9.1: add --version and copyright/license (GPL v2+) information

 .gitignore                 |    4 
 Makefile                   |   32 +++
 git-svn.perl               |  382 +++++++++++++++++++++++++++++++--------------
 git-svn.txt                |   16 +
 t/t0000-contrib-git-svn.sh |  216 +++++++++++++++++++++++++
 5 files changed, 532 insertions(+), 118 deletions(-)

-- 
Eric Wong

```

## Eric Wong, 2006-02-20 18:57

Subject: [PATCH 2/9] git-svn: allow --find-copies-harder and -l<num> to be passed on commit
Message-ID: <11404618464102-git-send-email-normalperson@yhbt.net>
URL: https://gitlist.dev/e/11404618464102-git-send-email-normalperson%40yhbt.net
In-Reply-To: <11404618452729-git-send-email-normalperson@yhbt.net>

```
Both of these options are passed directly to git-diff-tree when
committing to a SVN repository.

Signed-off-by: Eric Wong <normalperson@yhbt.net>

---

 contrib/git-svn/git-svn     |   10 ++++++++--
 contrib/git-svn/git-svn.txt |    7 +++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

f00770e6f3151e5fdc94208efab22b3068dbb882
diff --git a/contrib/git-svn/git-svn b/contrib/git-svn/git-svn
index 1a8f40e..477ec16 100755
--- a/contrib/git-svn/git-svn
+++ b/contrib/git-svn/git-svn
@@ -30,7 +30,8 @@ use Getopt::Long qw/:config gnu_getopt n
 use File::Spec qw//;
 my $sha1 = qr/[a-f\d]{40}/;
 my $sha1_short = qr/[a-f\d]{6,40}/;
-my ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit);
+my ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit,
+	$_find_copies_harder, $_l);
 
 GetOptions(	'revision|r=s' => \$_revision,
 		'no-ignore-externals' => \$_no_ignore_ext,
@@ -38,6 +39,8 @@ GetOptions(	'revision|r=s' => \$_revisio
 		'edit|e' => \$_edit,
 		'rmdir' => \$_rmdir,
 		'help|H|h' => \$_help,
+		'find-copies-harder' => \$_find_copies_harder,
+		'l=i' => \$_l,
 		'no-stop-on-copy' => \$_no_stop_copy );
 my %cmd = (
 	fetch => [ \&fetch, "Download new revisions from SVN" ],
@@ -348,7 +351,10 @@ sub svn_checkout_tree {
 	my $pid = open my $diff_fh, '-|';
 	defined $pid or croak $!;
 	if ($pid == 0) {
-		exec(qw(git-diff-tree -z -r -C), $from, $commit) or croak $!;
+		my @diff_tree = qw(git-diff-tree -z -r -C);
+		push @diff_tree, '--find-copies-harder' if $_find_copies_harder;
+		push @diff_tree, "-l$_l" if defined $_l;
+		exec(@diff_tree, $from, $commit) or croak $!;
 	}
 	my $mods = parse_diff_tree($diff_fh);
 	unless (@$mods) {
diff --git a/contrib/git-svn/git-svn.txt b/contrib/git-svn/git-svn.txt
index 4b79fb0..9912f5a 100644
--- a/contrib/git-svn/git-svn.txt
+++ b/contrib/git-svn/git-svn.txt
@@ -99,6 +99,13 @@ OPTIONS
 	default for objects that are commits, and forced on when committing
 	tree objects.
 
+-l<num>::
+--find-copies-harder::
+	Both of these are only used with the 'commit' command.
+
+	They are both passed directly to git-diff-tree see
+	git-diff-tree(1) for more information.
+
 COMPATIBILITY OPTIONS
 ---------------------
 --no-ignore-externals::
-- 
1.2.0.gdee6

```

## Eric Wong, 2006-02-20 18:57

Subject: [PATCH 3/9] git-svn: Allow for more argument types for commit (from..to)
Message-ID: <1140461846433-git-send-email-normalperson@yhbt.net>
URL: https://gitlist.dev/e/1140461846433-git-send-email-normalperson%40yhbt.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

```
