diff options
| author | K Jayatheerth <jayatheerthkulkarni2005@gmail.com> | 2025-07-24 20:54:18 +0530 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-07-24 13:35:08 -0700 |
| commit | bb10dcf5730356b9ef70d40eca2335e9d406954a (patch) | |
| tree | 0800fe82f6fac69e33141a9da01b9e32f84e0114 /t/t7413-submodule-is-active.sh | |
| parent | 1fa06ceddf1ea01bd85e277471ba79330666f037 (diff) | |
| download | git-bb10dcf5730356b9ef70d40eca2335e9d406954a.tar.gz | |
submodule: skip redundant active entries when pattern covers path
configure_added_submodule always writes an explicit
submodule.<name>.active entry, even when the new
path is already matched by submodule.active
patterns. This leads to unnecessary and cluttered configuration.
change the logic to centralize wildmatch-based pattern lookup,
in configure_added_submodule. Wrap the active-entry write in a conditional
that only fires when that helper reports no existing pattern covers the
submodule’s path.
Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7413-submodule-is-active.sh')
| -rwxr-xr-x | t/t7413-submodule-is-active.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t7413-submodule-is-active.sh b/t/t7413-submodule-is-active.sh index 9509dc18fd..6fd3b870de 100755 --- a/t/t7413-submodule-is-active.sh +++ b/t/t7413-submodule-is-active.sh @@ -124,4 +124,19 @@ test_expect_success 'is-active, submodule.active and submodule add' ' git -C super2 config --get submodule.mod.active ' +test_expect_success 'submodule add skips redundant active entry' ' + git init repo && + ( + cd repo && + git config submodule.active "lib/*" && + git commit --allow-empty -m init && + + git init ../lib-origin && + git -C ../lib-origin commit --allow-empty -m init && + + git submodule add ../lib-origin lib/foo && + test_must_fail git config --get submodule.lib/foo.active + ) +' + test_done |
