gitcache is a wrapper for git, so it needs to intercept the command line calls of git (resp. git.exe on windows). But to work with git, gitcache itself also has to call the real git command.
To ensure gitcache is called as git we can either
create a symlink from git to gitcache (this is the recommended setup documented in the README.md),
rename gitcache to git or
copy gitcache to git.
And to ensure it is called instead of the real git it must be placed in a directory referenced by the PATH variable before the directory containing the real git command. Actually, the real git command can also be in a directory not referenced by the PATH variable as long as the realgit config setting of gitcache is correct.
Currently, the detection of the real git command works by doing something similar to shutil.which but ignoring symlinks. This can lead to recursive calls of itself if the user did not create a symlink but a copy or rename operation.
So the initial detection of the real git command must be changed. Here, the question is how to identify an executable of git as a real git command. We can't use an option that is handled by git as any wrapper like ourself will simply forward it, but we can add an option to identify whether the candidate is actually gitcache by adding a new git option --identify.
gitcache is a wrapper for git, so it needs to intercept the command line calls of
git
(resp.git.exe
on windows). But to work with git, gitcache itself also has to call the real git command.To ensure gitcache is called as
git
we can eithergit
togitcache
(this is the recommended setup documented in the README.md),gitcache
togit
orgitcache
togit
.And to ensure it is called instead of the real git it must be placed in a directory referenced by the
PATH
variable before the directory containing the real git command. Actually, the real git command can also be in a directory not referenced by thePATH
variable as long as therealgit
config setting of gitcache is correct.Currently, the detection of the real git command works by doing something similar to
shutil.which
but ignoring symlinks. This can lead to recursive calls of itself if the user did not create a symlink but a copy or rename operation.So the initial detection of the real git command must be changed. Here, the question is how to identify an executable of
git
as a real git command. We can't use an option that is handled by git as any wrapper like ourself will simply forward it, but we can add an option to identify whether the candidate is actually gitcache by adding a new git option--identify
.