git-submodule: add test for the subcommand parser fix
This modifies the existing t7400 test to use 'init' as the
pathname that a submodule is bound to. Without the earlier
subcommand parser fix, this fails.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
echo "[OOPS] git config failed to update .gitmodules"
false
@ -71,7 +71,7 @@ test_expect_success 'status should initially be "missing"' '
@@ -71,7 +71,7 @@ test_expect_success 'status should initially be "missing"' '
test_expect_success 'init should register submodule url in .git/config' '
git-submodule init &&
url=$(git config submodule.example.url) &&
if test "$url" != "git://example.com/lib.git"
if test "$url" != "git://example.com/init.git"
then
echo "[OOPS] init succeeded but submodule url is wrong"
false
@ -83,41 +83,41 @@ test_expect_success 'init should register submodule url in .git/config' '
@@ -83,41 +83,41 @@ test_expect_success 'init should register submodule url in .git/config' '
'
test_expect_success 'update should fail when path is used by a file' '
echo "hello" >lib &&
echo "hello" >init &&
if git-submodule update
then
echo "[OOPS] update should have failed"
false
elif test "$(cat lib)" != "hello"
elif test "$(cat init)" != "hello"
then
echo "[OOPS] update failed but lib file was molested"
echo "[OOPS] update failed but init file was molested"
false
else
rm lib
rm init
fi
'
test_expect_success 'update should fail when path is used by a nonempty directory' '
mkdir lib &&
echo "hello" >lib/a &&
mkdir init &&
echo "hello" >init/a &&
if git-submodule update
then
echo "[OOPS] update should have failed"
false
elif test "$(cat lib/a)" != "hello"
elif test "$(cat init/a)" != "hello"
then
echo "[OOPS] update failed but lib/a was molested"
echo "[OOPS] update failed but init/a was molested"
false
else
rm lib/a
rm init/a
fi
'
test_expect_success 'update should work when path is an empty dir' '
rm -rf lib &&
mkdir lib &&
rm -rf init &&
mkdir init &&
git-submodule update &&
head=$(cd lib && git rev-parse HEAD) &&
head=$(cd init && git rev-parse HEAD) &&
if test -z "$head"
then
echo "[OOPS] Failed to obtain submodule head"
@ -134,7 +134,7 @@ test_expect_success 'status should be "up-to-date" after update' '
@@ -134,7 +134,7 @@ test_expect_success 'status should be "up-to-date" after update' '
'
test_expect_success 'status should be "modified" after submodule commit' '
cd lib &&
cd init &&
echo b >b &&
git add b &&
git-commit -m "submodule commit 2" &&
@ -157,8 +157,8 @@ test_expect_success 'git diff should report the SHA1 of the new submodule commit
@@ -157,8 +157,8 @@ test_expect_success 'git diff should report the SHA1 of the new submodule commit
'
test_expect_success 'update should checkout rev1' '
git-submodule update &&
head=$(cd lib && git rev-parse HEAD) &&
git-submodule update init &&
head=$(cd init && git rev-parse HEAD) &&
if test -z "$head"
then
echo "[OOPS] submodule git rev-parse returned nothing"