{"thread":{"id":"34020","subject":"[PATCH] Fix `git svn rebase` if top-level HEAD directory exist","startedAt":"2013-06-04T07:32:56Z","lastAt":"2013-06-05T05:32:50Z","messageCount":3,"participants":["ojab","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"219328","messageId":"51AD9828.7080508@ojab.ru","threadId":"34020","inReplyTo":null,"subject":"[PATCH] Fix `git svn rebase` if top-level HEAD directory exist","fromName":"ojab","fromEmail":"ojab@ojab.ru","sentAt":"2013-06-04T07:32:56Z","receivedAt":"2013-06-04T07:32:56Z","isPatch":true,"sender":{"key":"ojab@ojab.ru","avatar":null},"body":"Oh hai!\nI have a svn repo with the top-level directory named HEAD and `git svn \nrebase [HEAD] [--]` fails with\n> $ git svn rebase\n> fatal: ambiguous argument 'HEAD': both revision and filename\n> Use '--' to separate paths from revisions, like this:\n> 'git <command> [<revision>...] -- [<file>...]'\n> rev-list --first-parent --pretty=medium HEAD: command returned error: 128\n\nWorks fine with patch in the attached file. please review.\n\n//wbr ojab\n\n\nFrom 522cbc8b8a7c4f2ab4268551a550585753164677 Mon Sep 17 00:00:00 2001\nFrom: ojab <ojab@ojab.ru>\nDate: Tue, 4 Jun 2013 11:28:16 +0400\nSubject: [PATCH] Fix `git svn rebase` if top-level HEAD directory exist\nSigned-off-by: ojab <ojab@ojab.ru>\n\n---\n git-svn.perl | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex d070de0..e35a66a 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -1932,7 +1932,7 @@ sub cmt_sha2rev_batch {\n sub working_head_info {\n \tmy ($head, $refs) = @_;\n \tmy @args = qw/rev-list --first-parent --pretty=medium/;\n-\tmy ($fh, $ctx) = command_output_pipe(@args, $head);\n+\tmy ($fh, $ctx) = command_output_pipe(@args, $head, \"--\");\n \tmy $hash;\n \tmy %max;\n \twhile (<$fh>) {\n-- \n1.8.2\n\n"},{"id":"219330","messageId":"20130604074956.GA13555@sigill.intra.peff.net","threadId":"34020","inReplyTo":"51AD9828.7080508@ojab.ru","subject":"Re: [PATCH] Fix `git svn rebase` if top-level HEAD directory exist","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-06-04T07:49:56Z","receivedAt":"2013-06-04T07:49:56Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jun 04, 2013 at 11:32:56AM +0400, ojab wrote:\n\n> Oh hai!\n\nYou can haz patch?\n\n> I have a svn repo with the top-level directory named HEAD and `git\n> svn rebase [HEAD] [--]` fails with\n> >$ git svn rebase\n> >fatal: ambiguous argument 'HEAD': both revision and filename\n> >Use '--' to separate paths from revisions, like this:\n> >'git <command> [<revision>...] -- [<file>...]'\n> >rev-list --first-parent --pretty=medium HEAD: command returned error: 128\n\nThis rationale should probably go in the commit message.\n\n> From 522cbc8b8a7c4f2ab4268551a550585753164677 Mon Sep 17 00:00:00 2001\n> From: ojab <ojab@ojab.ru>\n> Date: Tue, 4 Jun 2013 11:28:16 +0400\n> Subject: [PATCH] Fix `git svn rebase` if top-level HEAD directory exist\n\nWe prefer patches to be inline in the email; these lines can be\ndropped, as they are picked up from your email headers.\n\n> Signed-off-by: ojab <ojab@ojab.ru>\n\nDo you mind providing a real name? The point of Signed-off-by is for\nlicensing and attribution.\n\n> diff --git a/git-svn.perl b/git-svn.perl\n> index d070de0..e35a66a 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -1932,7 +1932,7 @@ sub cmt_sha2rev_batch {\n>  sub working_head_info {\n>  \tmy ($head, $refs) = @_;\n>  \tmy @args = qw/rev-list --first-parent --pretty=medium/;\n> -\tmy ($fh, $ctx) = command_output_pipe(@args, $head);\n> +\tmy ($fh, $ctx) = command_output_pipe(@args, $head, \"--\");\n\nLooks obviously correct to me. I did a quick grep, and there is one\nother spot that probably should get the same treatment:\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex d070de0..07797ad 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -831,7 +831,7 @@ sub cmd_dcommit {\n sub cmd_dcommit {\n \tmy $head = shift;\n \tcommand_noisy(qw/update-index --refresh/);\n-\tgit_cmd_try { command_oneline(qw/diff-index --quiet HEAD/) }\n+\tgit_cmd_try { command_oneline(qw/diff-index --quiet HEAD --/) }\n \t\t'Cannot dcommit with a dirty index.  Commit your changes first, '\n \t\t. \"or stash them with `git stash'.\\n\";\n \t$head ||= 'HEAD';\n\nFeel free to squash it in if you re-roll your patch. There are a few\nother spots that feed full sha1s. They are probably less likely to\ntrigger, but perhaps should be protected, too, just in case.\n\n-Peff\n"},{"id":"219434","messageId":"51AECD82.4070908@ojab.ru","threadId":"34020","inReplyTo":"20130604074956.GA13555@sigill.intra.peff.net","subject":"Re: [PATCH] Fix `git svn rebase` if top-level HEAD directory exist","fromName":"ojab","fromEmail":"ojab@ojab.ru","sentAt":"2013-06-05T05:32:50Z","receivedAt":"2013-06-05T05:32:50Z","isPatch":true,"sender":{"key":"ojab@ojab.ru","avatar":null},"body":"On 04.06.2013 11:49, Jeff King wrote:\n\n> This rationale should probably go in the commit message.\n\nDone\n\n>\n> We prefer patches to be inline in the email; these lines can be\n> dropped, as they are picked up from your email headers.\n\nAFAIK Thunderbird brakes spaces, so better safe, than sorry :)\n\n> Do you mind providing a real name? The point of Signed-off-by is for\n> licensing and attribution.\n\nDone (but i doubt that such a patch can be copyrighted).\n\n> Looks obviously correct to me. I did a quick grep, and there is one\n> other spot that probably should get the same treatment:\n\nYep, already found it.\n\n//wbr ojab\n\n\n\nFrom 0251b7f2032e2050d2b6d2cbc0960471c996b058 Mon Sep 17 00:00:00 2001\nFrom: ojab <ojab@ojab.ru>\nDate: Tue, 4 Jun 2013 11:28:16 +0400\nSubject: [PATCH] Fix `git svn` `rebase` & `dcommit` if top-level HEAD\n directory exist\n\n$ git svn rebase\nfatal: ambiguous argument 'HEAD': both revision and filename\nUse '--' to separate paths from revisions, like this:\n'git <command> [<revision>...] -- [<file>...]'\nrev-list --first-parent --pretty=medium HEAD: command returned error: 128\n\nSigned-off-by: Slava Kardakov <ojab@ojab.ru>\n\n---\n git-svn.perl | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex d070de0..36083c1 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -831,7 +831,7 @@ sub dcommit_rebase {\n sub cmd_dcommit {\n \tmy $head = shift;\n \tcommand_noisy(qw/update-index --refresh/);\n-\tgit_cmd_try { command_oneline(qw/diff-index --quiet HEAD/) }\n+\tgit_cmd_try { command_oneline(qw/diff-index --quiet HEAD --/) }\n \t\t'Cannot dcommit with a dirty index.  Commit your changes first, '\n \t\t. \"or stash them with `git stash'.\\n\";\n \t$head ||= 'HEAD';\n@@ -1932,7 +1932,7 @@ sub cmt_sha2rev_batch {\n sub working_head_info {\n \tmy ($head, $refs) = @_;\n \tmy @args = qw/rev-list --first-parent --pretty=medium/;\n-\tmy ($fh, $ctx) = command_output_pipe(@args, $head);\n+\tmy ($fh, $ctx) = command_output_pipe(@args, $head, \"--\");\n \tmy $hash;\n \tmy %max;\n \twhile (<$fh>) {\n-- \n1.8.2\n\n"}]}