summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteffen Prohaska <prohaska@zib.de>2009-01-18 13:00:13 +0100
committerJunio C Hamano <gitster@pobox.com>2009-01-26 00:26:05 -0800
commit8e3462837b0ace04357503a3f58802cc2231df29 (patch)
tree24d1f1dfaf5875734b8c8649457dbecb9297fcf5
parent2fb3f6db96492b680899f9e40f434eeb4c778a84 (diff)
downloadgit-8e3462837b0ace04357503a3f58802cc2231df29.tar.gz
Modify setup_path() to only add git_exec_path() to PATH
Searching git programs only in the highest priority location is sufficient. It does not make sense that some of the required programs are located at the highest priority location but other programs are picked up from a lower priority exec-path. If exec-path is overridden a complete set of commands should be provided, otherwise several different versions could get mixed, which is likely to cause confusion. If a user explicitly overrides the default location (by --exec-path or GIT_EXEC_PATH), we now expect that all the required programs are found there. Instead of adding the directories "argv_exec_path", "getenv(EXEC_PATH_ENVIRONMENT)", and "system_path(GIT_EXEC_PATH)" to PATH, we now rely on git_exec_path(), which implements the same order, but only returns the highest priority location to search for executables. Accessing only the location with highest priority is also required for testing executables built with RUNTIME_PREFIX. The call to system_path() should be avoided if RUNTIME_PREFIX is set and the executable is not installed at its final destination. Because we test before installing, we want to avoid calling system_path() during tests. The modifications in this commit avoid calling system_path(GIT_EXEC_PATH) if a higher-priority location is provided, which is the case when running the tests. Signed-off-by: Steffen Prohaska <prohaska@zib.de> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--exec_cmd.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/exec_cmd.c b/exec_cmd.c
index f8f416b646..23f4873b2b 100644
--- a/exec_cmd.c
+++ b/exec_cmd.c
@@ -78,9 +78,7 @@ void setup_path(void)
const char *old_path = getenv("PATH");
struct strbuf new_path = STRBUF_INIT;
- add_path(&new_path, argv_exec_path);
- add_path(&new_path, getenv(EXEC_PATH_ENVIRONMENT));
- add_path(&new_path, system_path(GIT_EXEC_PATH));
+ add_path(&new_path, git_exec_path());
add_path(&new_path, argv0_path);
if (old_path)