Skip to contentSkip to conversation

Fix path duplication in git svn commit-diff

PATCH In review Karl Hasselström 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix path duplication in git svn commit-diff

Given an SVN repo file:///tmp/svntest/repo, trying to commit changes to a file proj/trunk/foo.txt in that repo with this command line

git svn commit-diff -r2 HEAD^ HEAD file:///tmp/svntest/repo/proj/trunk

gave the error message

Filesystem has no item: File not found: transaction '2-6', path '/proj/trunk/proj/trunk/foo.txt'

This fixes the duplication.

---

I really don't have a clue as to why this was broken, but the patch fixes the problem for me, and doesn't break the tests. I got the idea from dcommit, which is setting svn_path to '' unconditionally.

 git-svn.perl |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
git-svn.perl +1 -2
index 2c53f39..1c2a10a 100755
@@ -741,7 +741,7 @@ sub cmd_commit_diff {
 	my $usage = "Usage: $0 commit-diff -r<revision> ".
 	            "<tree-ish> <tree-ish> [<URL>]";
 	fatal($usage) if (!defined $ta || !defined $tb);
-	my $svn_path;
+	my $svn_path = '';
 	if (!defined $url) {
 		my $gs = eval { Git::SVN->new };
 		if (!$gs) {
@@ -765,7 +765,6 @@ sub cmd_commit_diff {
 		$_message ||= get_commit_entry($tb)->{log};
 	}
 	my $ra ||= Git::SVN::Ra->new($url);
-	$svn_path ||= $ra->{svn_path};
 	my $r = $_revision;
 	if ($r eq 'HEAD') {
 		$r = $ra->get_latest_revnum;
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Karl Hasselström

Given an SVN repo file:///tmp/svntest/repo, trying to commit changes to a file proj/trunk/foo.txt in that repo with this command line

git svn commit-diff -r2 HEAD^ HEAD file:///tmp/svntest/repo/proj/trunk

Quoted 8 lines

gave the error message

Filesystem has no item: File not found: transaction '2-6', path '/proj/trunk/proj/trunk/foo.txt'

This fixes the duplication.

Thanks Karl,

Quoted 5 lines

---

I really don't have a clue as to why this was broken, but the patch fixes the problem for me, and doesn't break the tests. I got the idea from dcommit, which is setting svn_path to '' unconditionally.

Hardly anybody uses commit-diff directly :)

It was a low-level plumbing command that I used to implement the original version of dcommit in.

Quoted 26 lines
 git-svn.perl |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
git-svn.perl +1 -2
index 2c53f39..1c2a10a 100755
@@ -741,7 +741,7 @@ sub cmd_commit_diff {
 	my $usage = "Usage: $0 commit-diff -r<revision> ".
 	            "<tree-ish> <tree-ish> [<URL>]";
 	fatal($usage) if (!defined $ta || !defined $tb);
-	my $svn_path;
+	my $svn_path = '';
 	if (!defined $url) {
 		my $gs = eval { Git::SVN->new };
 		if (!$gs) {
@@ -765,7 +765,6 @@ sub cmd_commit_diff {
 		$_message ||= get_commit_entry($tb)->{log};
 	}
 	my $ra ||= Git::SVN::Ra->new($url);
-	$svn_path ||= $ra->{svn_path};
 	my $r = $_revision;
 	if ($r eq 'HEAD') {
 		$r = $ra->get_latest_revnum;
Signature · 1 line
Eric Wong
#2 lore raw
Quoted 11 lines · Eric Wong
Quoted 4 lines · Karl Hasselström

I really don't have a clue as to why this was broken, but the patch fixes the problem for me, and doesn't break the tests. I got the idea from dcommit, which is setting svn_path to '' unconditionally.

Hardly anybody uses commit-diff directly :)

It was a low-level plumbing command that I used to implement the original version of dcommit in.

Yes. I was looking into how to call git-svn from StGit, and dcommit is a bit too smart to be easily scriptable.

Signature · 2 lines
Karl Hasselström, [email protected]
      www.treskal.com/kalle