2

I have a gitlab version 7.3 that is working totally fine when I work with normal repositories. However, I added a github submodule inside my gitlab project. On my repo, I did after commit and push ( git push --recurse-submodules=check ) and it worked perfectly.

But now, I can see my commit on gitlab, but the diff isnt displayed when I browse it on my gitlab with chrome. All the commits on files outside the submodules are well displayed meanwhile. Is that a known issue?

Do I have something to do another way?

Nicolas D
  • 1,182
  • 18
  • 40

1 Answers1

2

It is a known issue... about Git itself.

It was resolved today with Git 2.11 and its new git diff --submodule=diff:

enter image description here (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)

diff --submodule=diff: don't print failure message twice

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I wasnt expecting eaching the limits of git so early! Do you think when it will be implemented on gitlab it will be retroactive and I will see properly my diffs one day in gitlab? (i don't expect a formal yes knowing that you won't personally implement this, but just by experience I want your opinion) Thanks for the information, I will forgot using the GUI of gitlab for a while until it is updated then. – Nicolas D Dec 01 '16 at 10:01
  • 1
    @NicolasD the best course of action is to log an issue on the GitLab project requesting for integrating that new Git feature. – VonC Dec 01 '16 at 10:05
  • it is done in this issue https://gitlab.com/gitlab-org/gitlab-ce/issues/25213. I will keep this SO question updated when the issue is solved. – Nicolas D Dec 01 '16 at 10:35