Merge branch 'jk/doc-coding-guideline'
[gitweb.git] / t / t1305-config-include.sh
index a70707620f146d3fce69f77e08cae3a47253f157..9ba2ba11c3cac88154dbb2d522b43adf98a8dee7 100755 (executable)
@@ -113,7 +113,7 @@ test_expect_success 'missing include files are ignored' '
 test_expect_success 'absolute includes from command line work' '
        echo "[test]one = 1" >one &&
        echo 1 >expect &&
-       git -c include.path="$PWD/one" config test.one >actual &&
+       git -c include.path="$(pwd)/one" config test.one >actual &&
        test_cmp expect actual
 '
 
@@ -122,6 +122,36 @@ test_expect_success 'relative includes from command line fail' '
        test_must_fail git -c include.path=one config test.one
 '
 
+test_expect_success 'absolute includes from blobs work' '
+       echo "[test]one = 1" >one &&
+       echo "[include]path=$(pwd)/one" >blob &&
+       blob=$(git hash-object -w blob) &&
+       echo 1 >expect &&
+       git config --blob=$blob test.one >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'relative includes from blobs fail' '
+       echo "[test]one = 1" >one &&
+       echo "[include]path=one" >blob &&
+       blob=$(git hash-object -w blob) &&
+       test_must_fail git config --blob=$blob test.one
+'
+
+test_expect_success 'absolute includes from stdin work' '
+       echo "[test]one = 1" >one &&
+       echo 1 >expect &&
+       echo "[include]path=\"$(pwd)/one\"" |
+       git config --file - test.one >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'relative includes from stdin line fail' '
+       echo "[test]one = 1" >one &&
+       echo "[include]path=one" |
+       test_must_fail git config --file - test.one
+'
+
 test_expect_success 'include cycles are detected' '
        cat >.gitconfig <<-\EOF &&
        [test]value = gitconfig