lein-tar
lein-tar copied to clipboard
FileNotFoundException after running git pack-refs
git pack-refs --all
changes the .git
internal structure, placing all refs in .git/packed-refs
and deletes the individual files in .git/refs/
. This can also be done implicitly by other commands like git gc
.
The plugin will then crash as it tries to lookup a non-existing file: https://github.com/technomancy/lein-tar/blob/09f253c311974cb4d687075c89fbe7646152f9f0/src/leiningen/tar.clj#L65
FWIW, anyone who hits this issue can work around it by unpacking refs with this script: https://github.com/tj/git-extras/blob/7f0f91b4d429a11fdaecd5ad4c03c733470b07a1/bin/git-unpack-refs
I think we probably did this to avoid shelling out to git. What's a good solution here?
My guess would be catching the exception and parsing the .git/packed-refs
file in the exception handler.
10 internet points on offer if you put that up in a PR - except check for the file and fall back to the packed location instead of doing Flow Control Through Exceptions.