1098
test_must_fail git config --file=linktolinktonada --list
1099
'
1100
1101
-test_expect_success 'check split_cmdline return' "
1102
- git config alias.split-cmdline-fix 'echo \"' &&
1103
- test_must_fail git split-cmdline-fix &&
1104
- echo foo > foo &&
1105
- git add foo &&
1106
- git commit -m 'initial commit' &&
1107
- git config branch.main.mergeoptions 'echo \"' &&
1108
- test_must_fail git merge main
1109
-"
1101
+test_expect_success 'check split_cmdline return' '
1102
+ test_when_finished "rm -rf repo" &&
1103
+ git init repo &&
1104
+ (
1105
+ cd repo &&
1106
+ git config alias.split-cmdline-fix "echo \"" &&
1107
+ test_must_fail git split-cmdline-fix &&
1108
+ echo foo >foo &&
1109
+ git add foo &&
1110
+ git commit -m "initial commit" &&
1111
+ git config branch.main.mergeoptions "echo \"" &&
1112
+ test_must_fail git merge main
1113
+ )
1114
+'
1115
1116
test_expect_success 'git -c "key=value" support' '
1117
cat >expect <<-\EOF &&
1162
'
1163
1164
test_expect_success 'aliases can be CamelCased' '
1160
- test_config alias.CamelCased "rev-parse HEAD" &&
1161
- git CamelCased >out &&
1162
- git rev-parse HEAD >expect &&
1163
- test_cmp expect out
1165
+ test_when_finished "rm -rf repo" &&
1166
+ git init repo &&
1167
+ (
1168
+ cd repo &&
1169
+ test_commit A &&
1170
+ git config alias.CamelCased "rev-parse HEAD" &&
1171
+ git CamelCased >out &&
1172
+ git rev-parse HEAD >expect &&
1173
+ test_cmp expect out
1174
+ )
1175
'
1176
1177
test_expect_success 'git -c does not split values on equals' '
2020
'
2021
2022
test_expect_success 'set up custom config file' '
2012
- CUSTOM_CONFIG_FILE="custom.conf" &&
2013
- cat >"$CUSTOM_CONFIG_FILE" <<-\EOF
2023
+ cat >"custom.conf" <<-\EOF &&
2024
[user]
2025
custom = true
2026
EOF
2027
+ CUSTOM_CONFIG_FILE="$(test-tool path-utils real_path custom.conf)"
2028
'
2029
2030
test_expect_success !MINGW 'set up custom config file with special name characters' '
2063
'
2064
2065
test_expect_success '--show-origin blob' '
2055
- blob=$(git hash-object -w "$CUSTOM_CONFIG_FILE") &&
2056
- cat >expect <<-EOF &&
2057
- blob:$blob user.custom=true
2058
- EOF
2059
- git config --blob=$blob --show-origin --list >output &&
2060
- test_cmp expect output
2066
+ test_when_finished "rm -rf repo" &&
2067
+ git init repo &&
2068
+ (
2069
+ cd repo &&
2070
+ blob=$(git hash-object -w "$CUSTOM_CONFIG_FILE") &&
2071
+ cat >expect <<-EOF &&
2072
+ blob:$blob user.custom=true
2073
+ EOF
2074
+ git config --blob=$blob --show-origin --list >output &&
2075
+ test_cmp expect output
2076
+ )
2077
'
2078
2079
test_expect_success '--show-origin blob ref' '
2064
- cat >expect <<-\EOF &&
2065
- blob:main:custom.conf user.custom=true
2066
- EOF
2067
- git add "$CUSTOM_CONFIG_FILE" &&
2068
- git commit -m "new config file" &&
2069
- git config --blob=main:"$CUSTOM_CONFIG_FILE" --show-origin --list >output &&
2070
- test_cmp expect output
2080
+ test_when_finished "rm -rf repo" &&
2081
+ git init repo &&
2082
+ (
2083
+ cd repo &&
2084
+ cat >expect <<-\EOF &&
2085
+ blob:main:custom.conf user.custom=true
2086
+ EOF
2087
+ cp "$CUSTOM_CONFIG_FILE" custom.conf &&
2088
+ git add custom.conf &&
2089
+ git commit -m "new config file" &&
2090
+ git config --blob=main:custom.conf --show-origin --list >output &&
2091
+ test_cmp expect output
2092
+ )
2093
'
2094
2095
test_expect_success '--show-origin with --default' '