aboutsummaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-30 12:08:26 -0800
committerJunio C Hamano <gitster@pobox.com>2010-01-30 13:56:56 -0800
commitb0883aa6c77111e88496bd0afe073caf68ab9f99 (patch)
treeb4f021814276c6dd698ef6e810e61f3cd0221193 /submodule.c
parenta9c7c4364a6c1e0d95790cf2c8697b5b6ff30b1b (diff)
downloadgit-b0883aa6c77111e88496bd0afe073caf68ab9f99.tar.gz
git-b0883aa6c77111e88496bd0afe073caf68ab9f99.tar.xz
is_submodule_modified(): fix breakage with external GIT_INDEX_FILEv1.7.0-rc1
Even when the environment was given for the top-level process, checking in the submodule work tree should use the index file associated with the work tree of the submodule. Do not export it to the environment. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/submodule.c b/submodule.c
index ca0527fbc..6f7c21090 100644
--- a/submodule.c
+++ b/submodule.c
@@ -126,7 +126,7 @@ int is_submodule_modified(const char *path)
"--porcelain",
NULL,
};
- char *env[3];
+ char *env[4];
struct strbuf buf = STRBUF_INIT;
strbuf_addf(&buf, "%s/.git/", path);
@@ -142,7 +142,9 @@ int is_submodule_modified(const char *path)
env[0] = strbuf_detach(&buf, NULL);
strbuf_addf(&buf, "GIT_DIR=%s/.git", path);
env[1] = strbuf_detach(&buf, NULL);
- env[2] = NULL;
+ strbuf_addf(&buf, "GIT_INDEX_FILE");
+ env[2] = strbuf_detach(&buf, NULL);
+ env[3] = NULL;
memset(&cp, 0, sizeof(cp));
cp.argv = argv;
@@ -161,6 +163,7 @@ int is_submodule_modified(const char *path)
free(env[0]);
free(env[1]);
+ free(env[2]);
strbuf_release(&buf);
return len != 0;
}