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

Git error when branch has top level directory with the same name #6188

Closed
5 tasks done
externl opened this issue May 30, 2019 · 1 comment
Closed
5 tasks done

Git error when branch has top level directory with the same name #6188

externl opened this issue May 30, 2019 · 1 comment
Labels
help wanted We want help addressing this outdated PR was locked due to age

Comments

@externl
Copy link
Contributor

externl commented May 30, 2019

Please note that we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.

  • are reporting a bug others will be able to reproduce and not asking a question. If you're not sure or want to ask a question do so on our Discourse: https://discourse.brew.sh
  • ran a brew command and reproduced the problem with multiple formulae? If it's a problem with a single, official formula (not cask) please file this issue at Homebrew/homebrew-core: https://github.com/Homebrew/homebrew-core/issues/new/choose. If it's a brew cask problem please file this issue at https://github.com/Homebrew/homebrew-cask/issues/new/choose. If it's a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.
  • ran brew update and can still reproduce the problem?
  • ran brew doctor, fixed all issues and can still reproduce the problem?
  • ran brew config and brew doctor and included their output with your issue?

What you were trying to do (and why)

Create a formulae with the following url (from branch swift that has a top level folder also named swift:

url "https://github.com/zeroc-ice/ice.git", :tag => "swift"

What happened (include command output)

During a second run brew install (using the now cached repo) brew tires to update/reset the git branch and fails.

Command output

==> Cloning https://github.com/zeroc-ice/ice.git
Updating /Users/joe/Library/Caches/Homebrew/slice2swift--git
git config remote.origin.url https://github.com/zeroc-ice/ice.git
git config remote.origin.fetch +refs/tags/swift:refs/tags/swift
git config remote.origin.tagOpt --no-tags
==> Checking out tag swift
git checkout -f swift --
Already on 'swift'
git reset --hard swift
fatal: ambiguous argument 'swift': both revision and filename
Use '--' to separate paths from revisions, like this:
'git [...] -- [...]'
Error: An exception occurred within a child process:
DownloadError: Failed to download resource "slice2swift"
Failure while executing; git reset --hard swift exited with 128. Here's the output:
fatal: ambiguous argument 'swift': both revision and filename
Use '--' to separate paths from revisions, like this:
'git [...] -- [...]'

What you expected to happen

Formula will install

Step-by-step reproduction instructions (by running brew commands)

create formula with branch name XXX and top level folder in that repo with the same name XXX.
brew install
brew install a second time

@externl externl changed the title Git error when branch has directory with the same name Git error when branch has top level directory with the same name May 30, 2019
@MikeMcQuaid MikeMcQuaid added the help wanted We want help addressing this label May 30, 2019
@MikeMcQuaid
Copy link
Member

Thanks, good report. The fix for this will be to add -- to the relevant Git commands so it knows it's a revision and not a path.

reitermarkus added a commit that referenced this issue May 31, 2019
Fix #6188 - Remove ambiguity from branch reset command
@lock lock bot added the outdated PR was locked due to age label Jan 1, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted We want help addressing this outdated PR was locked due to age
Projects
None yet
Development

No branches or pull requests

2 participants