Code

local push/pull env cleanup
authorMatt Draisey <matt@draisey.ca>
Thu, 19 Jan 2006 20:58:03 +0000 (15:58 -0500)
committerJunio C Hamano <junkio@cox.net>
Wed, 25 Jan 2006 08:10:14 +0000 (00:10 -0800)
remove environment variables relating to the current repository
before execing the 'remote' half of a local push or pull operation

[jc: the original from Matt spelled out the environment variable
 names, which I changed to the preprocessor symbols defined in
 cache.h.  Also it missed GRAFT_ENVIRONMENT.]

Signed-off-by: Junio C Hamano <junkio@cox.net>
connect.c

index d6f4e4c3a7748a30528dce609ae3b6db09d4bd1d..e1c04e1eaeb5b1d7c86f70fbad1a5167b58c1b17 100644 (file)
--- a/connect.c
+++ b/connect.c
@@ -644,10 +644,16 @@ int git_connect(int fd[2], char *url, const char *prog)
                                ssh_basename++;
                        execlp(ssh, ssh_basename, host, command, NULL);
                }
-               else
+               else {
+                       unsetenv(ALTERNATE_DB_ENVIRONMENT);
+                       unsetenv(DB_ENVIRONMENT);
+                       unsetenv(GIT_DIR_ENVIRONMENT);
+                       unsetenv(GRAFT_ENVIRONMENT);
+                       unsetenv(INDEX_ENVIRONMENT);
                        execlp("sh", "sh", "-c", command, NULL);
+               }
                die("exec failed");
-       }               
+       }
        fd[0] = pipefd[0][0];
        fd[1] = pipefd[1][1];
        close(pipefd[0][1]);