Scan for git on windows

Viewed 45

I have started to dive into some of the emacs file I/O that goes on during some of the stalls on my windows box.

I noticed that when I open an org file in my notes repository that emacs seems to scan my path repeatedly looking for any mention of some kind of git binary, batch file btm, com etc. There is a fairly massive list of directories scanned and it seems to be scanned continuously. While I know this is not the entire reason for the slow down it's on set of I/O operations it seems I should be able to get rid of. Digging around a bit I noticed that magit-git-w32-path-hack seems to have the exact list of paths scanned. I am afraid I do not know the history of this variable.

I am tempted to simply truncate this variable to the exact path of my git for windows installation, but I am concerned that there are factors at play here that I do not understand.

Would someone have some advice as to the purpose of this variable and how it is populated?

1 Answers

The alternative to "getting rid of the magit/magit lisp/magit-git.el#magit-git-w32-path-hack variable is to set magit-git-executable to an absolute path.

That is detailed in "Magit / Git Executable".

But note that doing so is a kludge. It is better to make sure the order in the environment variable $PATH is correct, and that Emacs is started with that environment in effect.

The command magit-debug-git-executable can be useful to find out where Emacs is searching for git.
If you have to connect from Windows to a non-Windows machine, then you must change the value to "git".

Related