xutils: Fix hashing an incomplete line with whitespaces at the end
[gitweb.git] / exec_cmd.c
index ce6741eb682b59ad638c7bee6ca31e2fcd53f281..351fec2e9e374eacaeba88d2a7dddf11f5e331ce 100644 (file)
@@ -25,6 +25,10 @@ void git_set_argv0_path(const char *path)
 void git_set_argv_exec_path(const char *exec_path)
 {
        argv_exec_path = exec_path;
+       /*
+        * Propagate this setting to external programs.
+        */
+       setenv(EXEC_PATH_ENVIRONMENT, exec_path, 1);
 }
 
 
@@ -59,9 +63,7 @@ static void add_path(struct strbuf *out, const char *path)
 void setup_path(void)
 {
        const char *old_path = getenv("PATH");
-       struct strbuf new_path;
-
-       strbuf_init(&new_path, 0);
+       struct strbuf new_path = STRBUF_INIT;
 
        add_path(&new_path, argv_exec_path);
        add_path(&new_path, getenv(EXEC_PATH_ENVIRONMENT));