]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Fix `git svn` `rebase` & `dcommit` if top-level HEAD directory exist
authorSlava Kardakov <ojab@ojab.ru>
Wed, 5 Jun 2013 18:31:27 +0000 (11:31 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 Jun 2013 20:38:48 +0000 (13:38 -0700)
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>
git-svn.perl

index d070de012c3a04ca621782f047425318ff246ca6..36083c1072d928132bd9d144495f8332cdc7003d 100755 (executable)
@@ -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>) {