seeraven / gitcache

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

Git config call is not beeing routed #15

Closed soma-web closed 1 year ago

soma-web commented 1 year ago
git config --list

is not beeing routed to git

seeraven commented 1 year ago

That is strange, I tested with the latest release and the command was correctly routed to git. Can you post more information about the version of gitcache you are running, the operating system and the error message (if any)?

dgow commented 1 year ago

MinGW

$ which git
/c/Users/User/bin/git

$ pwd
/c/Users/User/bin

ls -l git
git.exe -> gitcache.exe

$ git --version
gitcache v1.0.11

$ git config --list
usage: git.exe [-h] [--version] [-c] [-u] [-d MIRROR] [-s] [-z]
git.exe: error: unrecognized arguments: config --list

CMD

C:\Users\User>git --version
2023-10-31 14:48:28 handle_git_command(['git'], ['--version']) started
2023-10-31 14:48:28 bail out
2023-10-31 14:48:28 Loading configuration file F:\gitcache\config.
git version 2.37.0.windows.1

this seems to happen under mingw. not a big deal, but the big problem is when we use gh (github CLI). Same strange behaviour with CMD

F:\my_worker\Release\develop>gh release create -t 1 1
usage: git.exe [-h] [--version] [-c] [-u] [-d MIRROR] [-s] [-z]
git.exe: error: unrecognized arguments: remote -v
C:\Users\User\bin\git.exe: exit status 2

F:\my_worker\Release\develop>
seeraven commented 1 year ago

I have identified the problem. Under MinGW the internal program name (sys.argv[0] in python) is always the name of the file, but within CMD it is the name specified on the command line. So if you call git --version in MinGW the command line arguments seen by the python executable are actually ["git.exe", "--version"], whereas in CMD it would be ["git", "--version"]. The detection of gitcache on whether it was called as a wrapper for git checks currently only for the string "git" and not "git.exe". This causes the problem in MinGW and I guess also in the github CLI. I'm preparing a new release that will fix this issue.

seeraven commented 1 year ago

I've created a new release just now (version v1.0.12). Can you test whether it fixes this issue?

dgow commented 1 year ago

Thanks a lot! everything is fine now! it works on mingw, cmd and github cli! and thank you for making this great tool!!! ❤

seeraven commented 1 year ago

Glad to hear it! :-) I'll close this issue then.