提交 b0e67fff 编写于 作者: J Junio C Hamano

Merge branch 'jh/maint-config-file-prefix' into maint

* jh/maint-config-file-prefix:
  builtin-config: Fix crash when using "-f <relative path>" from non-root dir
...@@ -340,7 +340,7 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix) ...@@ -340,7 +340,7 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)
if (!is_absolute_path(given_config_file) && prefix) if (!is_absolute_path(given_config_file) && prefix)
config_exclusive_filename = prefix_filename(prefix, config_exclusive_filename = prefix_filename(prefix,
strlen(prefix), strlen(prefix),
argv[2]); given_config_file);
else else
config_exclusive_filename = given_config_file; config_exclusive_filename = given_config_file;
} }
......
...@@ -398,6 +398,17 @@ test_expect_success 'alternative GIT_CONFIG' 'cmp output expect' ...@@ -398,6 +398,17 @@ test_expect_success 'alternative GIT_CONFIG' 'cmp output expect'
test_expect_success 'alternative GIT_CONFIG (--file)' \ test_expect_success 'alternative GIT_CONFIG (--file)' \
'git config --file other-config -l > output && cmp output expect' 'git config --file other-config -l > output && cmp output expect'
test_expect_success 'refer config from subdirectory' '
mkdir x &&
(
cd x &&
echo strasse >expect
git config --get --file ../other-config ein.bahn >actual &&
test_cmp expect actual
)
'
GIT_CONFIG=other-config git config anwohner.park ausweis GIT_CONFIG=other-config git config anwohner.park ausweis
cat > expect << EOF cat > expect << EOF
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册