Skip to content

Conversation

pmiossec
Copy link
Member

When trying to checkout a branch with the same name than an existing folder like 'scripts" in GitExtensions repository, git fails when running command line: git rev-list afe67a23d35300169ba539bb220be43e788dbfb0 ^scripts --count

with error:
fatal: ambiguous argument 'scripts': both revision and filename
Use '--' to separate paths from revisions, like this:
'git [...] -- [...]'

Fix: replace by command line:line
git rev-list afe67a23d35300169ba539bb220be43e788dbfb0 ^scripts --count --

Screenshots

Before

image

After

No error

Test methodology

  • Manual (and command line)

Test environment(s)

  • Git Extensions 33.33.33
  • Build d1d0db0 (Dirty)
  • Git 2.42.0.windows.2
  • Microsoft Windows NT 10.0.22621.0
  • .NET 6.0.21
  • DPI 96dpi (no scaling)
  • Portable: False
  • Microsoft.WindowsDesktop.App Versions
    Microsoft.WindowsDesktop.App 6.0.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
    Microsoft.WindowsDesktop.App 7.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Merge strategy

I agree that the maintainer squash merge this PR (if the commit message is clear).


✒️ I contribute this code under The Developer Certificate of Origin.

@ghost ghost assigned pmiossec Oct 16, 2023
@RussKie
Copy link
Member

RussKie commented Oct 16, 2023 via email

@pmiossec pmiossec force-pushed the error_ambiguous_name branch from 98ad0e8 to bdd024b Compare October 17, 2023 07:34
When trying to checkout a branch **with the same name than an existing folder**
like 'scripts" in GitExtensions repository, git fails when running command line:
git rev-list afe67a23d35300169ba539bb220be43e788dbfb0 ^scripts --count

 with error:
   fatal: ambiguous argument 'scripts': both revision and filename
   Use '--' to separate paths from revisions, like this:
   'git <command> [<revision>...] -- [<file>...]'

Fix: replace by command line:line
git rev-list afe67a23d35300169ba539bb220be43e788dbfb0 ^scripts --count --
@pmiossec pmiossec force-pushed the error_ambiguous_name branch from bdd024b to 08730ee Compare October 17, 2023 07:35
@pmiossec
Copy link
Member Author

Is it possible to add a regression test simulating the original situation?

Done.

@RussKie RussKie merged commit d391b9c into gitextensions:release/4.0 Oct 17, 2023
@pmiossec pmiossec deleted the error_ambiguous_name branch October 17, 2023 10:04
@RussKie RussKie added this to the 4.2 milestone Oct 31, 2023
pmiossec added a commit to pmiossec/gitextensions that referenced this pull request Nov 21, 2023
by parsing correctly the output of the command
`git branch --list --merged HEAD`
that contains "+ " prefix in front of branch names
checked out in worktrees

Fixes gitextensions#11375

+ makes git log command a little more resilient by appending '--' like done in gitextensions#11277
pmiossec added a commit to pmiossec/gitextensions that referenced this pull request Nov 21, 2023
by parsing correctly the output of the command
`git branch --list --merged HEAD`
that contains "+ " prefix in front of branch names
checked out in git worktrees

+ add support of some other edge cases

Fixes gitextensions#11375

+ makes git log command a little more resilient by appending '--' like done in gitextensions#11277
pmiossec added a commit to pmiossec/gitextensions that referenced this pull request Nov 21, 2023
by parsing correctly the output of the command
`git branch --list --merged HEAD`
that contains "+ " prefix in front of branch names
checked out in git worktrees

+ add support of some other edge cases

Fixes gitextensions#11375

+ makes git log command a little more resilient by appending '--' like done in gitextensions#11277
pmiossec added a commit to pmiossec/gitextensions that referenced this pull request Nov 21, 2023
by parsing correctly the output of the command
`git branch --list --merged HEAD`
that contains "+ " prefix in front of branch names
checked out in git worktrees

+ add support of some other edge cases

Fixes gitextensions#11375

+ makes git log command a little more resilient by appending '--' like done in gitextensions#11277
pmiossec added a commit to pmiossec/gitextensions that referenced this pull request Nov 21, 2023
by parsing correctly the output of the command
`git branch --list --merged HEAD`
that contains "+ " prefix in front of branch names
checked out in git worktrees

+ add support of some other edge cases

Fixes gitextensions#11375

+ makes git log command a little more resilient by appending '--' like done in gitextensions#11277
pmiossec added a commit to pmiossec/gitextensions that referenced this pull request Nov 22, 2023
by parsing correctly the output of the command
`git branch --list --merged HEAD`
that contains "+ " prefix in front of branch names
checked out in git worktrees

+ add support of some other edge cases

Fixes gitextensions#11375

+ makes git log command a little more resilient by appending '--' like done in gitextensions#11277
RussKie pushed a commit that referenced this pull request Nov 23, 2023
…#11376)

by parsing correctly the output of the command
`git branch --list --merged HEAD`
that contains "+ " prefix in front of branch names
checked out in git worktrees

+ add support of some other edge cases

Fixes #11375

+ makes git log command a little more resilient by appending '--' like done in #11277
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants