git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix `git svn rebase` if top-level HEAD directory exist
@ 2013-06-04  7:32 ojab
  2013-06-04  7:49 ` Jeff King
  0 siblings, 1 reply; 3+ messages in thread
From: ojab @ 2013-06-04  7:32 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 446 bytes --]

Oh hai!
I have a svn repo with the top-level directory named HEAD and `git svn 
rebase [HEAD] [--]` fails with
> $ git svn rebase
> fatal: ambiguous argument 'HEAD': both revision and filename
> Use '--' to separate paths from revisions, like this:
> 'git <command> [<revision>...] -- [<file>...]'
> rev-list --first-parent --pretty=medium HEAD: command returned error: 128

Works fine with patch in the attached file. please review.

//wbr ojab

[-- Attachment #2: 0001-Fix-git-svn-rebase-if-top-level-HEAD-directory-exist.patch --]
[-- Type: text/plain, Size: 745 bytes --]

From 522cbc8b8a7c4f2ab4268551a550585753164677 Mon Sep 17 00:00:00 2001
From: ojab <ojab@ojab.ru>
Date: Tue, 4 Jun 2013 11:28:16 +0400
Subject: [PATCH] Fix `git svn rebase` if top-level HEAD directory exist
Signed-off-by: ojab <ojab@ojab.ru>

---
 git-svn.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-svn.perl b/git-svn.perl
index d070de0..e35a66a 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1932,7 +1932,7 @@ sub cmt_sha2rev_batch {
 sub working_head_info {
 	my ($head, $refs) = @_;
 	my @args = qw/rev-list --first-parent --pretty=medium/;
-	my ($fh, $ctx) = command_output_pipe(@args, $head);
+	my ($fh, $ctx) = command_output_pipe(@args, $head, "--");
 	my $hash;
 	my %max;
 	while (<$fh>) {
-- 
1.8.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix `git svn rebase` if top-level HEAD directory exist
  2013-06-04  7:32 [PATCH] Fix `git svn rebase` if top-level HEAD directory exist ojab
@ 2013-06-04  7:49 ` Jeff King
  2013-06-05  5:32   ` ojab
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2013-06-04  7:49 UTC (permalink / raw)
  To: ojab; +Cc: git

On Tue, Jun 04, 2013 at 11:32:56AM +0400, ojab wrote:

> Oh hai!

You can haz patch?

> I have a svn repo with the top-level directory named HEAD and `git
> svn rebase [HEAD] [--]` fails with
> >$ git svn rebase
> >fatal: ambiguous argument 'HEAD': both revision and filename
> >Use '--' to separate paths from revisions, like this:
> >'git <command> [<revision>...] -- [<file>...]'
> >rev-list --first-parent --pretty=medium HEAD: command returned error: 128

This rationale should probably go in the commit message.

> From 522cbc8b8a7c4f2ab4268551a550585753164677 Mon Sep 17 00:00:00 2001
> From: ojab <ojab@ojab.ru>
> Date: Tue, 4 Jun 2013 11:28:16 +0400
> Subject: [PATCH] Fix `git svn rebase` if top-level HEAD directory exist

We prefer patches to be inline in the email; these lines can be
dropped, as they are picked up from your email headers.

> Signed-off-by: ojab <ojab@ojab.ru>

Do you mind providing a real name? The point of Signed-off-by is for
licensing and attribution.

> diff --git a/git-svn.perl b/git-svn.perl
> index d070de0..e35a66a 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -1932,7 +1932,7 @@ sub cmt_sha2rev_batch {
>  sub working_head_info {
>  	my ($head, $refs) = @_;
>  	my @args = qw/rev-list --first-parent --pretty=medium/;
> -	my ($fh, $ctx) = command_output_pipe(@args, $head);
> +	my ($fh, $ctx) = command_output_pipe(@args, $head, "--");

Looks obviously correct to me. I did a quick grep, and there is one
other spot that probably should get the same treatment:

diff --git a/git-svn.perl b/git-svn.perl
index d070de0..07797ad 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -831,7 +831,7 @@ sub cmd_dcommit {
 sub cmd_dcommit {
 	my $head = shift;
 	command_noisy(qw/update-index --refresh/);
-	git_cmd_try { command_oneline(qw/diff-index --quiet HEAD/) }
+	git_cmd_try { command_oneline(qw/diff-index --quiet HEAD --/) }
 		'Cannot dcommit with a dirty index.  Commit your changes first, '
 		. "or stash them with `git stash'.\n";
 	$head ||= 'HEAD';

Feel free to squash it in if you re-roll your patch. There are a few
other spots that feed full sha1s. They are probably less likely to
trigger, but perhaps should be protected, too, just in case.

-Peff

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix `git svn rebase` if top-level HEAD directory exist
  2013-06-04  7:49 ` Jeff King
@ 2013-06-05  5:32   ` ojab
  0 siblings, 0 replies; 3+ messages in thread
From: ojab @ 2013-06-05  5:32 UTC (permalink / raw)
  To: Jeff King; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 620 bytes --]

On 04.06.2013 11:49, Jeff King wrote:

> This rationale should probably go in the commit message.

Done

>
> We prefer patches to be inline in the email; these lines can be
> dropped, as they are picked up from your email headers.

AFAIK Thunderbird brakes spaces, so better safe, than sorry :)

> Do you mind providing a real name? The point of Signed-off-by is for
> licensing and attribution.

Done (but i doubt that such a patch can be copyrighted).

> Looks obviously correct to me. I did a quick grep, and there is one
> other spot that probably should get the same treatment:

Yep, already found it.

//wbr ojab


[-- Attachment #2: 0001-Fix-git-svn-rebase-dcommit-if-top-level-HEAD-directo.patch --]
[-- Type: text/plain, Size: 1414 bytes --]

From 0251b7f2032e2050d2b6d2cbc0960471c996b058 Mon Sep 17 00:00:00 2001
From: ojab <ojab@ojab.ru>
Date: Tue, 4 Jun 2013 11:28:16 +0400
Subject: [PATCH] Fix `git svn` `rebase` & `dcommit` if top-level HEAD
 directory exist

$ git svn rebase
fatal: ambiguous argument 'HEAD': both revision and filename
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
rev-list --first-parent --pretty=medium HEAD: command returned error: 128

Signed-off-by: Slava Kardakov <ojab@ojab.ru>

---
 git-svn.perl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index d070de0..36083c1 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -831,7 +831,7 @@ sub dcommit_rebase {
 sub cmd_dcommit {
 	my $head = shift;
 	command_noisy(qw/update-index --refresh/);
-	git_cmd_try { command_oneline(qw/diff-index --quiet HEAD/) }
+	git_cmd_try { command_oneline(qw/diff-index --quiet HEAD --/) }
 		'Cannot dcommit with a dirty index.  Commit your changes first, '
 		. "or stash them with `git stash'.\n";
 	$head ||= 'HEAD';
@@ -1932,7 +1932,7 @@ sub cmt_sha2rev_batch {
 sub working_head_info {
 	my ($head, $refs) = @_;
 	my @args = qw/rev-list --first-parent --pretty=medium/;
-	my ($fh, $ctx) = command_output_pipe(@args, $head);
+	my ($fh, $ctx) = command_output_pipe(@args, $head, "--");
 	my $hash;
 	my %max;
 	while (<$fh>) {
-- 
1.8.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-05  5:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-04  7:32 [PATCH] Fix `git svn rebase` if top-level HEAD directory exist ojab
2013-06-04  7:49 ` Jeff King
2013-06-05  5:32   ` ojab

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).