]> git.ipfire.org Git - thirdparty/git.git/blobdiff - run-command.c
Allow environment variables to be unset in the processes started by run_command
[thirdparty/git.git] / run-command.c
index 4ee4bdf16c1c5288d63ed0ba9a4503d04377c19e..7e779d33ee9ea5f7d2e6aedc8c3a0a0476e87135 100644 (file)
@@ -77,8 +77,12 @@ int start_command(struct child_process *cmd)
                        die("exec %s: cd to %s failed (%s)", cmd->argv[0],
                            cmd->dir, strerror(errno));
                if (cmd->env) {
-                       for (; *cmd->env; cmd->env++)
-                               putenv((char*)*cmd->env);
+                       for (; *cmd->env; cmd->env++) {
+                               if (strchr(*cmd->env, '='))
+                                       putenv((char*)*cmd->env);
+                               else
+                                       unsetenv(*cmd->env);
+                       }
                }
                if (cmd->git_cmd) {
                        execv_git_cmd(cmd->argv);