git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Claus Schneider <claus.schneider@eficode.com>,
	phillip.wood@dunelm.org.uk
Cc: Claus Schneider via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Emily Shaffer <emilyshaffer@google.com>,
	Calvin Wan <calvinwan@google.com>
Subject: Re: [PATCH 0/5] git-add : Respect submodule ignore=all and only add changes with --force
Date: Fri, 24 Oct 2025 14:55:46 +0100	[thread overview]
Message-ID: <63d07c3c-ac4b-4ef9-ad90-d79f00cc7ca9@gmail.com> (raw)
In-Reply-To: <CA+GP4bqb775U5oBbLZg1dou+THJOjTbFN+2Pq1cBPqq1SgbxHw@mail.gmail.com>

Hi Claus

On 19/10/2025 22:39, Claus Schneider wrote:
> On Sun, Oct 19, 2025, 17:34 Phillip Wood <phillip.wood123@gmail.com 
> <mailto:phillip.wood123@gmail.com>> wrote:
> 
>> I was curious why, when "git add" uses the same machinery as "git diff"
>> to figure out which paths need updating, it behaves differently. It
>> turns out that add_files_to_cache() contains
>> 
>>           rev.diffopt.flags.override_submodule_config = 1;
>> 
>> which makes "git add" ignore "submodule.<name>.ignore". Tracing the
>> history of this line, it originates from 5556808690e (add, reset: ensure
>> submodules can be added or reset, 2017-07-25) which made a deliberate
>> choice for both "git add" and "git reset" not to behave like "git diff".

> Thank you for your feedback and for investigating this. I was not aware > of the setting that causes `add` and `reset` to override submodule 
> configuration, and I will need to look into `reset` further.

You should mention the commit that added the current behavior and the
reason it was added in the commit message where you change the behavior.

> I understand the problematic aspect of not being able to add an update 
> of a submodule reference, which likely led to the overwrite setting. 
> From a Git developer's perspective, always adding it might have seemed 
> like the simplest approach.
> 
> However, from an end-user perspective, it's not logical for `status` to 
> show nothing while `add` has an effect. 

I'm quite sympathetic to this view, I think you should explain this in the
commit message where you change the behavior and see what others think.

> A more intuitive workflow would 
> align with how ignored files are handled even though it is already tracked.

As I said before do not think conflating ignoring changes to tracked files
with ignoring files is a good idea. The two are fundamentally different
because ignored files are not tracked. I would suggest adding a new option
such as "--include-ignored-submodules" instead of piggybacking on "--force".
Using a different option also means that user's will not accidentally stage
ignored files when they're trying to stage a submodule whose changes are
normally ignored.

> My patch implements what I believe should have been in the first place. 
> My implementation still needs the `overwrite=1` set in order to get the 
> diff files list so I can 'operate' on it and make the `--force` logic 
> like the ignore files.

Oh, you're right, if we want to print a warning we will need to keep
overriding the submodule config.

Hopefully someone with more experience of submodules will be able to review
the code soon.

Thanks

Phillip


  parent reply	other threads:[~2025-10-24 13:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-18 20:07 [PATCH 0/5] git-add : Respect submodule ignore=all and only add changes with --force Claus Schneider via GitGitGadget
2025-10-18 20:07 ` [PATCH 1/5] read-cache: update add_files_to_cache to take param ignored_too(--force) Claus Schneider(Eficode) via GitGitGadget
2025-10-18 20:07 ` [PATCH 2/5] read-cache: let read-cache respect submodule ignore=all and --force Claus Schneider(Eficode) via GitGitGadget
2025-10-18 20:07 ` [PATCH 3/5] tests: add new t2206-add-submodule-ignored.sh to test ignore=all scenario Claus Schneider(Eficode) via GitGitGadget
2025-10-18 20:07 ` [PATCH 4/5] tests: fix existing tests when add an ignore=all submodule Claus Schneider(Eficode) via GitGitGadget
2025-10-18 20:07 ` [PATCH 5/5] Documentation: update add --force and submodule ignore=all config Claus Schneider(Eficode) via GitGitGadget
2025-10-19 15:34 ` [PATCH 0/5] git-add : Respect submodule ignore=all and only add changes with --force Phillip Wood
     [not found]   ` <CA+GP4bpu3SUycG35DU5+NSuiqtfYN9-R=7d01EFhexgGh4sRPg@mail.gmail.com>
2025-10-20  7:28     ` Claus Schneider
     [not found]   ` <CA+GP4bqb775U5oBbLZg1dou+THJOjTbFN+2Pq1cBPqq1SgbxHw@mail.gmail.com>
2025-10-24 13:55     ` Phillip Wood [this message]
2025-11-13 12:51       ` Claus Schneider
2025-11-13 18:10 ` [PATCH v2 " Claus Schneider via GitGitGadget
2025-11-13 18:10   ` [PATCH v2 1/5] read-cache: update add_files_to_cache take param include_ignored_submodules Claus Schneider(Eficode) via GitGitGadget
2025-11-13 22:07     ` Junio C Hamano
2025-11-13 18:10   ` [PATCH v2 2/5] read-cache: add/read-cache respect submodule ignore=all Claus Schneider(Eficode) via GitGitGadget
2025-11-13 18:10   ` [PATCH v2 3/5] tests: add new t2206-add-submodule-ignored.sh to test ignore=all scenario Claus Schneider(Eficode) via GitGitGadget
2025-11-13 18:10   ` [PATCH v2 4/5] tests: fix existing tests when add an ignore=all submodule Claus Schneider(Eficode) via GitGitGadget
2025-11-13 18:10   ` [PATCH v2 5/5] Documentation: add --include_ignored_submodules + ignore=all config Claus Schneider(Eficode) via GitGitGadget
2025-11-13 19:58   ` [PATCH v2 0/5] git-add : Respect submodule ignore=all and only add changes with --force Junio C Hamano
2025-11-14 13:53     ` Claus Schneider

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

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

  git send-email \
    --in-reply-to=63d07c3c-ac4b-4ef9-ad90-d79f00cc7ca9@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=calvinwan@google.com \
    --cc=claus.schneider@eficode.com \
    --cc=emilyshaffer@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=phillip.wood@dunelm.org.uk \
    /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.
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 NNTP newsgroup(s).