Merge branch 'pk/status-of-uncloned-submodule'

The way "git submodule status" reports an initialized but not yet
populated submodule has not been reimplemented correctly when a
part of the "git submodule" command was rewritten in C, which has
been corrected.

* pk/status-of-uncloned-submodule:
  t7400: testcase for submodule status on unregistered inner git repos
  submodule: fix status of initialized but not cloned submodules
  t7400: add a testcase for submodule status on empty dirs
This commit is contained in:
Junio C Hamano
2020-02-14 12:54:23 -08:00
2 changed files with 34 additions and 1 deletions

View File

@ -55,6 +55,21 @@ test_expect_success 'add aborts on repository with no commits' '
test_i18ncmp expect actual
'
test_expect_success 'status should ignore inner git repo when not added' '
rm -fr inner &&
mkdir inner &&
(
cd inner &&
git init &&
>t &&
git add t &&
git commit -m "initial"
) &&
test_must_fail git submodule status inner 2>output.err &&
rm -fr inner &&
test_i18ngrep "^error: .*did not match any file(s) known to git" output.err
'
test_expect_success 'setup - repository in init subdirectory' '
mkdir init &&
(
@ -412,6 +427,14 @@ test_expect_success 'init should register submodule url in .git/config' '
test_cmp expect url
'
test_expect_success 'status should still be "missing" after initializing' '
rm -fr init &&
mkdir init &&
git submodule status >lines &&
rm -fr init &&
grep "^-$rev1" lines
'
test_failure_with_unknown_submodule () {
test_must_fail git submodule $1 no-such-submodule 2>output.err &&
test_i18ngrep "^error: .*no-such-submodule" output.err