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

source-repository package git clone: fatal: '--detach' cannot be used with '-b/-B/--orphan' #8235

Open
robx opened this issue Jun 20, 2022 · 0 comments

Comments

@robx
Copy link
Collaborator

robx commented Jun 20, 2022

Describe the bug
I ran into the following error while working with a forked local dependency:

  1. add a source-repository-package entry to cabal.project.local, pointing to a valid local repository but non-existent tag:
source-repository-package
  location: /s/bytestring-strict-builder
  type: git
  tag: unsafe
  1. cabal build errors out as it should:
$ cabal build
Cloning into '[...]/dist-newstyle/src/bytestrin_-75233e9c287669b1'...
done.
fatal: invalid reference: unsafe
  1. I create the branch in the forked repo
  2. cabal build fails with an unexpected git error:
$ cabal build
[... regular git copying output]
From /s/bytestring-strict-builder
 * [new branch]      unsafe     -> origin/unsafe
fatal: '--detach' cannot be used with '-b/-B/--orphan'

After this, running cabal build again reports the same error. After wiping dist-newstyle/src/bytestr*, the build works fine.

To Reproduce

I've run the above steps again and arrived at the same result. I have not yet made sure it happens with arbitrary repositories instead of the specific ones I encountered this with, though I expect it to be a general issue.

Expected behavior
In step 4, cabal build should manage to check out the correct branch.

System information

  • Operating system: macOS 12.4
  • cabal 3.6.2.0 via ghcup, git in PATH is git version 2.32.1 (Apple Git-133) (but I'm not entirely sure this is what cabal calls)

Additional context
This is related to #6888. However, that ticket is specific to the redundant branch setting, while this one appears to be a bug with tag which I understand to be the "standard" way to specify a revision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants