]> Kevux Git Server - rit/commit
read-cache: submodule add need --force given ignore=all configuration
authorClaus Schneider(Eficode) <claus.schneider@eficode.com>
Fri, 6 Feb 2026 13:22:57 +0000 (13:22 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Feb 2026 17:43:26 +0000 (09:43 -0800)
commita16c4a245acb2420bafcbd572ba9fb94b1ba5146
treedcd0b573b4e458a3388b97647ba3ad50652c4821
parent37196d8995ee60e08230c5d05dfd26204d604580
read-cache: submodule add need --force given ignore=all configuration

Submodules configured with ignore=all are now skipped during add operations
unless overridden by --force and the submodule path is explicitly specified.

A message is printed (like ignored files) guiding the user to use the
--force flag if the user explicitly wants to update the submodule reference.

The reason for the change is to support branch tracking in submodules
with configuration `submdule.<name>.branch` or similar workflows where the
user is not interested in tracking each update of the sha1 in the submdule.
You can additionally set `submodule.<name>.ignore=all` and the `git status`
will state nothing and, with this patch, the `git add` does not either - as
the default behaviour. This patch changes the workflow to a more logical
behaviour and similar to workflow for ignored files.

The patch gives more scenarios for submodules to be used effectively with
less friction similar to the "repo" tool. A submodule can be added for many
different reasons than a hard dependency. It can be added as loosely
coupled dependencies whereas the user wants the latest based on the
configuration `submoule.<name>.branch`, but are not interested to track
each commit in the `super-repo`. Currently it gives friction of handling
conflicts between branches even the sha1's are fast-forward and the user
just wants the latest in any way. The user can still add a sha1 explicitly
to track updates.

Signed-off-by: Claus Schneider(Eficode) <claus.schneider@eficode.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
read-cache.c