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:
Junio C Hamano 2016-03-24 12:27:12 -07:00
commit 2a4c8c36a7
2 changed files with 16 additions and 3 deletions

View file

@ -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);

View file

@ -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 &&