Example ebuild: # cat ghc-99999.ebuild EAPI=5 inherit git-r3 SLOT=0 EGIT_REPO_URI="https://git.haskell.org/ghc.git" referring seemingly problematic submodule: [submodule ".arc-linters/arcanist-external-json-linter"] path = .arc-linters/arcanist-external-json-linter url = ../arcanist-external-json-linter.git (full .gitmodules: http://git.haskell.org/ghc.git/blob/b8abd852d3674cb485490d2b2e94906c06ee6e8f:/.gitmodules#l118 ) fails as: $ ebuild ghc-99999.ebuild clean unpack >>> Unpacking source... * Fetching https://git.haskell.org/ghc.git ... git fetch https://git.haskell.org/ghc.git +HEAD:refs/git-r3/HEAD git symbolic-ref refs/git-r3/dev-lang/ghc/0/__main__ refs/heads/master * Fetching https://git.haskell.org/packages/binary.git ... ... * Fetching https://git.haskell.org/arcanist-external-json-linter.git ... git fetch https://git.haskell.org/arcanist-external-json-linter.git --prune +refs/heads/*:refs/heads/* +refs/tags/*:refs/tags/* +refs/notes/*:refs/notes/* +HEAD:refs/git-r3/HEAD git update-ref --no-deref refs/git-r3/dev-lang/ghc/0/.arc-linters/arcanist-external-json-linter/__main__ 85ece0f8653e7b1e7de6024d372cfeaf36ab5fa9 fatal: update_ref failed for ref 'refs/git-r3/dev-lang/ghc/0/.arc-linters/arcanist-external-json-linter/__main__': refusing to update ref with bad name refs/git-r3/dev-lang/ghc/0/.arc-linters/arcanist-external-json-linter/__main__ * ERROR: dev-lang/ghc-99999::haskell failed (unpack phase): * Referencing 85ece0f8653e7b1e7de6024d372cfeaf36ab5fa9 failed (wrong ref?). * * Call stack: * ebuild.sh, line 133: Called src_unpack * environment, line 2476: Called git-r3_src_unpack * environment, line 1740: Called git-r3_src_fetch * environment, line 1734: Called git-r3_fetch * environment, line 1672: Called git-r3_fetch 'https://git.haskell.org/arcanist-external-json-linter.git' '85ece0f8653e7b1e7de6024d372cfeaf36ab5fa9' 'dev-lang/ghc/0/.arc-linters/arcanist-external-json-linter' * environment, line 1647: Called die * The specific snippet of code: * die "Referencing ${remote_ref} failed (wrong ref?)."; * * If you need support, post the output of `emerge --info '=dev-lang/ghc-99999::haskell'`, * the complete build log and the output of `emerge -pqv '=dev-lang/ghc-99999::haskell'`. * The complete build log is located at '/tmp/portage/dev-lang/ghc-99999/temp/build.log'. * The ebuild environment file is located at '/tmp/portage/dev-lang/ghc-99999/temp/environment'. * Working directory: '/tmp/portage/dev-lang/ghc-99999/work' * S: '/tmp/portage/dev-lang/ghc-99999/work/ghc-99999'
I'll try to take a look at this today. If you happen to have some extra time, could you confirm whether it's complaining about the dot, or something else?
Removing a dot certainly changes error message into better direction: ghc.git $ git update-ref --no-deref refs/git-r3/dev-lang/ghc/0/.arc-linters/arcanist-external-json-linter/__main__ 85ece0f8653e7b1e7de6024d372cfeaf36ab5fa9 fatal: update_ref failed for ref 'refs/git-r3/dev-lang/ghc/0/.arc-linters/arcanist-external-json-linter/__main__': refusing to update ref with bad name refs/git-r3/dev-lang/ghc/0/.arc-linters/arcanist-external-json-linter/__main__ ghcgit $ git update-ref --no-deref refs/git-r3/dev-lang/ghc/0/arc-linters/arcanist-external-json-linter/__main__ 85ece0f8653e7b1e7de6024d372cfeaf36ab5fa9 fatal: update_ref failed for ref 'refs/git-r3/dev-lang/ghc/0/arc-linters/arcanist-external-json-linter/__main__': cannot update the ref 'refs/git-r3/dev-lang/ghc/0/arc-linters/arcanist-external-json-linter/__main__': Trying to write ref refs/git-r3/dev-lang/ghc/0/arc-linters/arcanist-external-json-linter/__main__ with nonexistent object 85ece0f8653e7b1e7de6024d372cfeaf36ab5fa9
Looks like a good list: https://github.com/git/git/blob/master/refs.c#L39 /* * Try to read one refname component from the front of refname. * Return the length of the component found, or -1 if the component is * not legal. It is legal if it is something reasonable to have under * ".git/refs/"; We do not like it if: * * - any path component of it begins with ".", or * - it has double dots "..", or * - it has ASCII control characters, or * - it has ":", "?", "[", "\", "^", "~", SP, or TAB anywhere, or * - it has "*" anywhere unless REFNAME_REFSPEC_PATTERN is set, or * - it ends with a "/", or * - it ends with ".lock", or * - it contains a "@{" portion */
I'm sorry this is taking this long. I'm currently working on it, and should have a solution today. While at it, I've discovered that https://git.haskell.org seems not to support shallow clones: git fetch https://git.haskell.org/ghc.git +HEAD:refs/git-r3/HEAD --depth 1 fatal: The remote end hung up unexpectedly fatal: protocol error: bad pack header In case you haven't noticed it, this means you'd need to set EGIT_MIN_CLONE_TYPE in the ebuild.
commit 9dd95690e6f4ff62d66595eb2e0f78c223b32a3e Author: Michał Górny <mgorny@gentoo.org> Date: Fri Feb 5 15:35:19 2016 git-r3.eclass: Filter out /. components from submodule refs, #572312