Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add '--' to 'git rev-list' to disambiguate branch name from path #4185

Merged
merged 1 commit into from
Jan 20, 2025

Conversation

efussi
Copy link
Contributor

@efussi efussi commented Jan 19, 2025

  • PR Description

When deleting a local branch that has the same name as a file known to git (say test), a popup with the following error is shown:

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

The command log reveals this:

git rev-list --max-count=1 test ^HEAD ^refs/heads/main
  • Please check if the PR fulfills these requirements
  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

@efussi
Copy link
Contributor Author

efussi commented Jan 19, 2025

When adding the double dash, it works:
image

@jesseduffield jesseduffield added the bug Something isn't working label Jan 19, 2025
@stefanhaller
Copy link
Collaborator

LGTM, thanks. We fixed similar issues in other places before, and I suppose we still might have more of them in other places, but I guess it's ok to fix them when we come across them.

@stefanhaller stefanhaller merged commit a77dcbe into jesseduffield:master Jan 20, 2025
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants