Merge branch 'sb/submodule-init'

Update of "git submodule" to move pieces of logic to C continues.

* sb/submodule-init:
  submodule init: redirect stdout to stderr
  submodule--helper update-clone: abort gracefully on missing .gitmodules
  submodule init: fail gracefully with a missing .gitmodules file
  submodule: port init from shell to C
  submodule: port resolve_relative_url from shell to C
This commit is contained in:
Junio C Hamano
2016-05-17 14:38:16 -07:00
7 changed files with 461 additions and 141 deletions

View File

@ -18,6 +18,22 @@ test_expect_success 'setup - initial commit' '
git branch initial
'
test_expect_success 'submodule init aborts on missing .gitmodules file' '
test_when_finished "git update-index --remove sub" &&
git update-index --add --cacheinfo 160000,$(git rev-parse HEAD),sub &&
# missing the .gitmodules file here
test_must_fail git submodule init 2>actual &&
test_i18ngrep "No url found for submodule path" actual
'
test_expect_success 'submodule update aborts on missing .gitmodules file' '
test_when_finished "git update-index --remove sub" &&
git update-index --add --cacheinfo 160000,$(git rev-parse HEAD),sub &&
# missing the .gitmodules file here
git submodule update sub 2>actual &&
test_i18ngrep "Submodule path .sub. not initialized" actual
'
test_expect_success 'configuration parsing' '
test_when_finished "rm -f .gitmodules" &&
cat >.gitmodules <<-\EOF &&