Skip to content

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

@externl

Description

@externl

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedWe want help addressing thisoutdatedPR was locked due to age

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions