#!/bin/sh # # Copyright (c) 2014 Heiko Voigt # test_description='Test submodules config cache infrastructure This test verifies that parsing .gitmodules configuration directly from the database works. ' TEST_NO_CREATE_REPO=1 . ./test-lib.sh test_expect_success 'submodule config cache setup' ' mkdir submodule && (cd submodule && git init && echo a >a && git add . && git commit -ma ) && mkdir super && (cd super && git init && git submodule add ../submodule && git submodule add ../submodule a && git commit -m "add as submodule and as a" && git mv a b && git commit -m "move a to b" ) ' cat >super/expect <actual && test_cmp expect actual ) ' test_expect_success 'test parsing and lookup of submodule config by name' ' (cd super && test-submodule-config --name \ HEAD^ a \ HEAD a \ HEAD^ submodule \ HEAD submodule \ >actual && test_cmp expect actual ) ' cat >super/expect_error <>.gitmodules && git add .gitmodules && mv .gitmodules.bak .gitmodules && git commit -m "add error" && test-submodule-config \ HEAD b \ HEAD submodule \ >actual && test_cmp expect_error actual ) ' test_done