lein-tar icon indicating copy to clipboard operation
lein-tar copied to clipboard

FileNotFoundException after running git pack-refs

Open parasyte opened this issue 8 years ago • 3 comments

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

parasyte avatar Apr 15 '16 22:04 parasyte

I think we probably did this to avoid shelling out to git. What's a good solution here?

danlarkin avatar Apr 16 '16 05:04 danlarkin

My guess would be catching the exception and parsing the .git/packed-refs file in the exception handler.

parasyte avatar Apr 16 '16 20:04 parasyte

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.

danlarkin avatar Apr 17 '16 02:04 danlarkin