seeraven / gitcache

Local cache for git repositories to speed up working with large repositories and multiple clones.
BSD 3-Clause "New" or "Revised" License
37 stars 6 forks source link

Error fetching repos that don't have a master branch #22

Closed afabian closed 21 hours ago

afabian commented 1 year ago

We have a repository with various branches, but none called "master". It looks like that branch name is getting added and causing checkouts to fail:

2023-11-09 09:59:08 Command 'C:\Users\afabian\AppData\Local\Programs\Git\cmd\git.exe -c lfs.storage=c:\gitcache\cache\mirrors\REPO_PATH\lfs lfs fetch origin master' failed with return code 2. Starting retry 2 of 3. Invalid ref argument: [master]

I think the expected behavior is to check out the ref specified by the parent repository. Come to think of it, "master" would be wrong even if it did exist.

Edit: just realized I said "checkouts" but the actual command was "submodule update --init --recursive"

afabian commented 1 year ago

Awesome tool, by the way!

seeraven commented 1 year ago

The default branch resp. ref should be determined by calling git symbolic-ref --short HEAD or by using git show-ref <ref> if used within the git checkout <ref> context. So if you are using a recent version of gitcache, there is no hard-coded "master" in it. Can you check the output of the git symbolic-ref --short HEAD command? I would like to recreate an example repo simulating your use case. I assume you have a repository with one or more submodules (which in turn have again submodules) and at least some of them are using LFS, right?

seeraven commented 21 hours ago

I'm closing this issue as there was no answer to it for more than a year now. ;-) In case the issue persists, please open a new issue.