]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t1309-early-config.sh
config: correct file reading order in read_early_config()
[thirdparty/git.git] / t / t1309-early-config.sh
index b97357b8ab3aa47aff100e4012083891b57d9b46..1af8c454cfa715d5694c16b4848428ae0b75eda6 100755 (executable)
@@ -47,6 +47,24 @@ test_expect_success 'ceiling #2' '
        test xdg = "$(cat output)"
 '
 
+cmdline_config="'test.source=cmdline'"
+test_expect_success 'read config file in right order' '
+       echo "[test]source = home" >>.gitconfig &&
+       git init foo &&
+       (
+               cd foo &&
+               echo "[test]source = repo" >>.git/config &&
+               GIT_CONFIG_PARAMETERS=$cmdline_config test-config \
+                       read_early_config test.source >actual &&
+               cat >expected <<-\EOF &&
+               home
+               repo
+               cmdline
+               EOF
+               test_cmp expected actual
+       )
+'
+
 test_with_config () {
        rm -rf throwaway &&
        git init throwaway &&