Fix `git svn` `rebase` & `dcommit` if top-level HEAD directory exist
When a file (or a directory) called HEAD exists in the working tree, internal calls git svn makes trigger "did you mean a revision or a path?" ambiguity check. $ 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 Explicitly disambiguate by adding "--" after the revision. Signed-off-by: Slava Kardakov <ojab@ojab.ru> Reviewed-by: Jeff King <peff@peff.net> Acked-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Slava Kardakov committed
Jun 5, 2013 at 11:31 UTC
9926f66fbd4392c9c7c05fae83e80bc12e0be889
1 file changed
+2
-2
git-svn.perl
+2
-2
@@ -831,7 +831,7 @@ sub dcommit_rebase {
831
sub cmd_dcommit {
832
my $head = shift;
833
command_noisy(qw/update-index --refresh/);
834
- git_cmd_try { command_oneline(qw/diff-index --quiet HEAD/) }
834
+ git_cmd_try { command_oneline(qw/diff-index --quiet HEAD --/) }
835
'Cannot dcommit with a dirty index. Commit your changes first, '
836
. "or stash them with `git stash'.\n";
837
$head ||= 'HEAD';
@@ -1932,7 +1932,7 @@ sub cmt_sha2rev_batch {
1932
sub working_head_info {
1933
my ($head, $refs) = @_;
1934
my @args = qw/rev-list --first-parent --pretty=medium/;
1935
- my ($fh, $ctx) = command_output_pipe(@args, $head);
1935
+ my ($fh, $ctx) = command_output_pipe(@args, $head, "--");
1936
my $hash;
1937
my %max;
1938
while (<$fh>) {