git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jens Lehmann <Jens.Lehmann@web.de>
To: Ramkumar Ramachandra <artagnon@gmail.com>,
	Sergey Sharybin <sergey.vfx@gmail.com>
Cc: Jeff King <peff@peff.net>, Git List <git@vger.kernel.org>,
	Heiko Voigt <hvoigt@hvoigt.net>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: Git issues with submodules
Date: Fri, 22 Nov 2013 22:01:44 +0100	[thread overview]
Message-ID: <528FC638.5060403@web.de> (raw)
In-Reply-To: <CALkWK0muxsRUtO6KYk5G3=RVN0nqd=8gOZn=jsNbTc4B9KCATQ@mail.gmail.com>

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:

---------------------->8-------------------
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 ("log.date" 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;

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

        memset(&match_all, 0, sizeof(match_all));
---------------------->8-------------------

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.

  reply	other threads:[~2013-11-22 21:01 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-22  7:53 Git issues with submodules Sergey Sharybin
2013-11-22 11:16 ` Ramkumar Ramachandra
2013-11-22 11:35   ` Sergey Sharybin
2013-11-22 13:08     ` Ramkumar Ramachandra
2013-11-22 15:11       ` Jeff King
2013-11-22 15:42         ` Sergey Sharybin
2013-11-22 16:35           ` Ramkumar Ramachandra
2013-11-22 17:01             ` Sergey Sharybin
2013-11-22 17:40               ` Sergey Sharybin
2013-11-22 18:11                 ` Ramkumar Ramachandra
2013-11-22 21:01                   ` Jens Lehmann [this message]
2013-11-22 21:46                     ` Sergey Sharybin
2013-11-22 21:54                     ` Heiko Voigt
2013-11-22 22:09                       ` Jonathan Nieder
2013-11-23 20:10                         ` Jens Lehmann
2013-11-24  0:52                           ` Heiko Voigt
2013-11-24 16:29                             ` Jens Lehmann
2013-11-25  9:02                               ` Sergey Sharybin
2013-11-25 17:49                                 ` Heiko Voigt
2013-11-25 17:57                                   ` Sergey Sharybin
2013-11-25 18:15                                     ` Heiko Voigt
2013-12-04 22:16                                     ` [RFC/WIP PATCH 0/4] less ignorance of submodules for ignore=all Heiko Voigt
2013-12-04 22:19                                       ` [RFC/WIP PATCH 1/4] disable complete ignorance of submodules for index <-> HEAD diff Heiko Voigt
2013-12-04 22:21                                       ` [RFC/WIP PATCH 2/4] fix 'git add' to skip submodules configured as ignored Heiko Voigt
2013-12-04 22:21                                       ` [RFC/WIP PATCH 3/4] teach add -f option for ignored submodules Heiko Voigt
2013-12-06 23:10                                         ` Junio C Hamano
2013-12-09 21:51                                           ` Heiko Voigt
2013-12-04 22:23                                       ` [RFC/WIP PATCH 4/4] always show committed submodules in summary after commit Heiko Voigt
2013-12-04 22:26                                       ` [RFC/WIP PATCH 0/4] less ignorance of submodules for ignore=all Heiko Voigt
2013-12-04 22:32                                       ` Junio C Hamano
2013-12-04 23:19                                         ` Heiko Voigt
2013-12-05 20:51                                           ` Jens Lehmann
2013-12-09 21:41                                             ` Heiko Voigt
2013-12-09 22:25                                             ` Junio C Hamano
2013-11-25 21:01                               ` Git issues with submodules Junio C Hamano
2013-11-26 18:44                                 ` Jens Lehmann
2013-11-26 19:33                                   ` Junio C Hamano
2013-11-26 19:51                                     ` Jonathan Nieder
2013-11-26 22:19                                       ` Junio C Hamano
2013-11-23  1:11                       ` [RFC PATCH] disable complete ignorance of submodules for index <-> HEAD diff Heiko Voigt
2013-11-25  9:01                         ` Sergey Sharybin
2013-11-28  7:10                           ` Heiko Voigt
2013-11-29 23:11                             ` [RFC/WIP PATCH v2] " Heiko Voigt
2013-11-23  7:04                       ` Re: Git issues with submodules Ramkumar Ramachandra
2013-11-23 20:32                       ` Jens Lehmann
2013-11-24  1:06                         ` Heiko Voigt
2013-11-25 20:53                       ` Junio C Hamano
2013-11-29 22:50                         ` Heiko Voigt
2013-11-23  6:53                     ` Ramkumar Ramachandra
2013-11-22 16:12         ` Ramkumar Ramachandra
2013-11-22 20:20           ` Jens Lehmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=528FC638.5060403@web.de \
    --to=jens.lehmann@web.de \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hvoigt@hvoigt.net \
    --cc=peff@peff.net \
    --cc=sergey.vfx@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).