summaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2017-03-31 23:17:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-04-02 16:51:03 (GMT)
commit17b254cda6dd77b1a91ac6f2946943e52698efa9 (patch)
treedaab4649ea1392703c3b9edf202c61ce8d1bd3ac /submodule.c
parent3b9e3c2cede15057af3ff8076c45ad5f33829436 (diff)
downloadgit-17b254cda6dd77b1a91ac6f2946943e52698efa9.zip
git-17b254cda6dd77b1a91ac6f2946943e52698efa9.tar.gz
git-17b254cda6dd77b1a91ac6f2946943e52698efa9.tar.bz2
diff: submodule inline diff to initialize env array.
David reported: > When I try to run `git diff --submodule=diff` in a submodule which has > it's own submodules that have changes I get the error: fatal: bad > object. This happens, because we do not properly initialize the environment in which the diff is run in the submodule. That means we inherit the environment from the main process, which sets environment variables. (Apparently we do set environment variables which we do not set when not in a submodules, i.e. the .git directory is linked) This commit, just like fd47ae6a5b (diff: teach diff to display submodule difference with an inline diff, 2016-08-31) introduces bad test code (i.e. hard coded hash values), which will be cleanup up in a later patch. Reported-by: David Parrish <daveparrish@gmail.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/submodule.c b/submodule.c
index ece1731..17de8e8 100644
--- a/submodule.c
+++ b/submodule.c
@@ -476,6 +476,7 @@ void show_submodule_inline_diff(FILE *f, const char *path,
if (!(dirty_submodule & DIRTY_SUBMODULE_MODIFIED))
argv_array_push(&cp.args, oid_to_hex(new));
+ prepare_submodule_repo_env(&cp.env_array);
if (run_command(&cp))
fprintf(f, "(diff failed)\n");