It is a known issue... about Git itself.
It was resolved today with Git 2.11 and its new git diff --submodule=diff
:
(picture from "What is new in Git 2.11" from Tim Pettersen)
This is not available through GitLab GUI, since it just got released in Git.
Note: only Git 2.13 (Q2 2017) fixes a bug in that feature:
See commit 17b254c (31 Mar 2017) by Stefan Beller (stefanbeller
).
(Merged by Junio C Hamano -- gitster
-- in commit 1776a71, 17 Apr 2017)
Running git diff --submodule=diff
in a submodule which has it's own submodules that have changes 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)
Note: Git 2.14 still improve that command "git diff --submodule=diff
", which now recurses into nested submodules.
See commit 5a52214 (04 May 2017) by Stefan Beller (stefanbeller
).
(Merged by Junio C Hamano -- gitster
-- in commit a531ecf, 29 May 2017)
diff
: recurse into nested submodules for inline diff
When fd47ae6 (diff
: teach diff
to display submodule difference with an inline diff, 2016-08-31, Git 2.11) was introduced, we did not think of recursing into nested submodules.
When showing the inline diff for submodules, automatically recurse
into nested submodules as well with inline submodule diffs.
Before Git 2.34 (Q4 2021), "git diff --submodule=diff
"(man) showed failure from run_command()
when trying to run diff inside a submodule, when the user manually removes the submodule directory.
That has been fixed.
See commit 67f61ef, commit f1c0368 (31 Aug 2021), and commit 4577d26 (26 Jul 2021) by David Turner (csusbdt
).
(Merged by Junio C Hamano -- gitster
-- in commit 75405e7, 20 Sep 2021)
Signed-off-by: David Turner
When we fail to start a diff command inside a submodule, immediately exit the routine rather than trying to finish the command and printing a second message.