author | Junio C Hamano <gitster@pobox.com> | |
Wed, 10 Feb 2010 21:02:05 +0000 (13:02 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 10 Feb 2010 21:02:05 +0000 (13:02 -0800) |
* jh/maint-config-file-prefix:
builtin-config: Fix crash when using "-f <relative path>" from non-root dir
builtin-config: Fix crash when using "-f <relative path>" from non-root dir
builtin-config.c | patch | blob | history | |
t/t1300-repo-config.sh | patch | blob | history |
diff --git a/builtin-config.c b/builtin-config.c
index a2d656edb383da47fb3622f1f7c2d1524285ac00..78724fbf7dd8e2174ac8cc199241641289383c7f 100644 (file)
--- a/builtin-config.c
+++ b/builtin-config.c
if (!is_absolute_path(given_config_file) && prefix)
config_exclusive_filename = prefix_filename(prefix,
strlen(prefix),
- argv[2]);
+ given_config_file);
else
config_exclusive_filename = given_config_file;
}
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 83b7294010cd59d5438b6020868c699c01105595..9e74b1f1415822c758ccc81bd4f12dc15a16eaee 100755 (executable)
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
test_expect_success 'alternative GIT_CONFIG (--file)' \
'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
cat > expect << EOF