Description
When a git repository is cached, shards should use that and only that with --local
(no network requests). This does not seem to work, however. The cache contains bare repositories (only the git metadata without a worktree) which causes some issues with git commands.
In #611 (comment) I noticed a particular issue with GitResolver#origin_url
which runs git ls-remote --get-url origin
in the cache directory. But git doesn't know its a bare repository and searches for the next .git
folder up in the directory tree.
If the cache path is in the work tree of another git repository, it'll result in this repository's origin, which is obviously not what we're looking for.
If it's not in the work tree of another git repository (which should typically be the case with the default SHARDS_CACHE_PATH
), the result is origin
. This is a bit surprising and also not what what we're looking for.
So I'm wondering how (or if) origin_url
even works in the first place?
This should technically be easy to solve by adding the flag --bare
to let git now it's working on a bare repository. However we need to understand a bit more why this issue is happening and why it's not a bigger problem. I'm confused how other git commands seem to work with a bare repository just fine, even though they should be affected in a similar way.
I presume a similar issue might exist for other resolvers as well.