Re: [PATCH 1/2] Remember and use GIT_EXEC_PATH on exec()'s
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:16
Michal Ostrowski [off-list ref] writes:
If git-upload-pack is invoked by ssh, it may have been invoked because ssh was explicitly told which program to execute on the remote end (i.e. --exec had been used with git-clone-pack). In this case, the git suite may not be in the PATH, and so subsequent exec's by git-upload-pack (i.e. git-rev-list, git-pack-objects) will fail.
True.
+.environment.GIT_EXEC_PATH: + @(test -e $@ && grep -h -e '^$(bindir)$$' $@) || echo $(bindir) > $@
Hmph.
* I did not know "test -e" was portable (it is in POSIX.1),
but since you are creating the file yourself anyway,
wouldn't "test -f" look more familiar?
* Perhaps grep -F (--fixed-strings), not as regexp?
* I do not get the point of using "grep -h" here (it's not in
POSIX.1). Perhaps just >/dev/null?
But I like the timestamp trick here that uses ||. Maybe I
should borrow it for GIT-VERSION-GEN. Maybe not.
quoted hunk ↗ jump to hunk
--- a/environment.c +++ b/environment.c@@ -9,6 +9,10 @@ */ #include "cache.h" +#ifndef GIT_EXEC_PATH +#define GIT_EXEC_PATH NULL +#endif
I wonder if not having GIT_EXEC_PATH defined should be an error here.
+void git_setup_exec_path(void)
+{
...
+}Maybe move git.c::prepend_to_path() to a single library file and use it here?