Am 22.11.2013 19:11, schrieb Ramkumar Ramachandra:
> Sergey Sharybin wrote:
>> To reproduce the issue:
>> - Run git submodule update --recursive to make sure their SHA is
>> changed. Then `git add /path/to/changed submodule` or just `git add .`
>> - Modify any file from the parent repository
>> - Neither of `git status`, `git diff` and `git diff-files --name-only`
>> will show changes to a submodule, only changes to that file which was
>> changed in parent repo.
>> - Make a git commit. It will not list changes to submodule as wll.
>> - `git show HEAD` will show changes to both file from and parent
>> repository (which is expected) and will also show changes to the
>> submodule hash (which is unexpected i'd say).
> Thanks Sergey; I can confirm that this is a bug.

Hmm, looks like git show also needs to be fixed to honor the
ignore setting from .gitmodules. It already does that for
diff.ignoreSubmodules from either .git/config or git -c and
also supports the --ignore-submodules command line option.
The following fixes this inconsistency for me:

diff --git a/builtin/log.c b/builtin/log.c
index b708517..ca97cfb 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -25,6 +25,7 @@
 #include "version.h"
 #include "mailmap.h"
 #include "gpg-interface.h"
+#include "submodule.h"

 /* Set a default date-time format for git log ("" config variable) */
 static const char *default_date_mode = NULL;
@@ -521,6 +522,7 @@ int cmd_show(int argc, const char **argv, const char *prefix
        int i, count, ret = 0;

+       gitmodules_config();
        git_config(git_log_config, NULL);

        memset(&match_all, 0, sizeof(match_all));

But the question is if that is the right thing to do: should
diff.ignoreSubmodules and submodule.<name>.ignore only affect
the diff family or also git log & friends? That would make
users blind for submodule history (which they already are
when using diff & friends, so that might be ok here too).

> For some reason, the
> `git add .` is adding the ignored submodule to the index.

The ignore setting is documented to only affect diff output
(including what checkout, commit and status show as modified).
While I agree that this behavior is confusing for Sergey and
not optimal for the floating branch model he uses, git is
currently doing exactly what it should. And for people using
the ignore setting to not having to stat submodules with huge
and/or many files that behavior is what they want: don't bother
me with what changed, but commit what I did change on purpose.
We may have to rethink what should happen for users of the
floating branch model though.

> After that,
>   $ git diff-index @
> is not showing the ignored submodule.

Of course it isn't, it's configured not to. You'll have to use
--ignore-submodules=dirty to override the configuration to make
it show differences in the recorded hash.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to