seeraven / gitcache

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

git lfs pull is not handled by gitcache #2

Closed seeraven closed 2 years ago

seeraven commented 2 years ago

The git lfs pull command is not handled by gitcache, as it was not necessary with previous versions of git-lfs. However, the behaviour of git-lfs has changed and leads to errors when the remote (fetch URL) is set to the mirror. When the remote fetch URL is set to the remote repository, git lfs pull works as expected. This happens only if there are files to fetch, e.g., files that are filtered by default but are included using the command line options --include and --exclude "".

So the git lfs pull commands should be handled by gitcache in the following way:

  1. If the specified remote is not origin, proceed with the original git command.
  2. Change the remote fetch URL to the push URL.
  3. Perform the original git command.
  4. Restore the remote fetch URL.

An alternative would be to setup a temporary remote like real-origin and use that remote. This would have the advantage of being more robust in cases where the command is interrupted and leaving the temporary fetch URL.

seeraven commented 2 years ago

Fixed in current master.