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

Re: [PATCH] Fix `git svn rebase` if top-level HEAD directory exist

From
Jeff King <peff@peff.net>
Date
Jun 4, 2013, 07:49 UTC
Message-ID
<20130604074956.GA13555@sigill.intra.peff.net>
In-Reply-To
<51AD9828.7080508@ojab.ru>
On Tue, Jun 04, 2013 at 11:32:56AM +0400, ojab wrote:
> Oh hai!
You can haz patch?
Show 7 quoted lines
> 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.

Show 10 quoted lines
> 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
Previous: ojabNext: ojab
Message 2 of 3 in “Fix `git svn rebase` if top-level HEAD directory exist”
  1. Fix `git svn rebase` if top-level HEAD directory existojab, Jun 4, 2013
  2. Jeff KingJun 4, 2013
  3. ojabJun 5, 2013

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.