pub icon indicating copy to clipboard operation
pub copied to clipboard

`pub get` should more gracefully handle non-git dirs in the git pub cache

Open jakemac53 opened this issue 6 years ago • 1 comments

I ran into an issue today where I couldn't run a pub get (or upgrade) in any flutter_web project (even fresh ones).

The error I was getting was this:

fatal: not a git repository (or any parent up to mount point /usr/local)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

This was quite cryptic, and didn't indicate even which package dependency had failed. I later ran with -v and got some better information, it was trying to run a git fetch inside of the pub cache (specifically, at ~/.pub-cache/git/cache/flutter_web-c860685d0da1a4da933bd4d77e11442441614877), which was a completely empty directory.

I am not sure exactly how an empty directory got added there, presumably a previous git clone or something had failed.

Deleting the directory solved my problems, but it was difficult to resolve.

I think it would be reasonable to handle this scenario explicitly, by handling the not a git repository error and deleting the entire directory from the pub cache and retrying.

jakemac53 avatar May 09 '19 16:05 jakemac53

This seems still relevant

sigurdm avatar Jan 16 '25 09:01 sigurdm