mirror of
https://github.com/git/git
synced 2024-11-05 18:59:29 +00:00
Merge branch 'sb/submodule-module-list-pathspec-fix'
A fix for a small regression in "module_list" helper that was rewritten in C (also applies to 2.7.x). * sb/submodule-module-list-pathspec-fix: submodule: fix regression for deinit without submodules
This commit is contained in:
commit
2a4c8c36a7
2 changed files with 16 additions and 3 deletions
|
@ -37,9 +37,9 @@ static int module_list_compute(int argc, const char **argv,
|
||||||
for (i = 0; i < active_nr; i++) {
|
for (i = 0; i < active_nr; i++) {
|
||||||
const struct cache_entry *ce = active_cache[i];
|
const struct cache_entry *ce = active_cache[i];
|
||||||
|
|
||||||
if (!S_ISGITLINK(ce->ce_mode) ||
|
if (!match_pathspec(pathspec, ce->name, ce_namelen(ce),
|
||||||
!match_pathspec(pathspec, ce->name, ce_namelen(ce),
|
0, ps_matched, 1) ||
|
||||||
0, ps_matched, 1))
|
!S_ISGITLINK(ce->ce_mode))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ALLOC_GROW(list->entries, list->nr + 1, list->alloc);
|
ALLOC_GROW(list->entries, list->nr + 1, list->alloc);
|
||||||
|
|
|
@ -849,6 +849,19 @@ test_expect_success 'set up a second submodule' '
|
||||||
git commit -m "submodule example2 added"
|
git commit -m "submodule example2 added"
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'submodule deinit works on repository without submodules' '
|
||||||
|
test_when_finished "rm -rf newdirectory" &&
|
||||||
|
mkdir newdirectory &&
|
||||||
|
(
|
||||||
|
cd newdirectory &&
|
||||||
|
git init &&
|
||||||
|
>file &&
|
||||||
|
git add file &&
|
||||||
|
git commit -m "repo should not be empty"
|
||||||
|
git submodule deinit .
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'submodule deinit should remove the whole submodule section from .git/config' '
|
test_expect_success 'submodule deinit should remove the whole submodule section from .git/config' '
|
||||||
git config submodule.example.foo bar &&
|
git config submodule.example.foo bar &&
|
||||||
git config submodule.example2.frotz nitfol &&
|
git config submodule.example2.frotz nitfol &&
|
||||||
|
|
Loading…
Reference in a new issue