diff: submodule inline diff to initialize env array.
authorStefan Beller <sbeller@google.com>
Fri, 31 Mar 2017 23:17:32 +0000 (16:17 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 2 Apr 2017 16:51:03 +0000 (09:51 -0700)
commit17b254cda6dd77b1a91ac6f2946943e52698efa9
treedaab4649ea1392703c3b9edf202c61ce8d1bd3ac
parent3b9e3c2cede15057af3ff8076c45ad5f33829436
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>
submodule.c
t/t4060-diff-submodule-option-diff-format.sh