From 9c3796fc0474ac6fc77da4886a246a37a7fbe856 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 20 Jun 2006 00:51:58 +0200 Subject: Fix setting config variables with an alternative GIT_CONFIG When setting a config variable, git_config_set() ignored the variables GIT_CONFIG and GIT_CONFIG_LOCAL. Now, when GIT_CONFIG_LOCAL is set, it will write to that file. If not, GIT_CONFIG is checked, and only as a fallback, the change is written to $GIT_DIR/config. Add a test for it, and also future-proof the test for the upcoming $HOME/.gitconfig support. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t1300-repo-config.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 't/t1300-repo-config.sh') diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 8260d57b63..0de2497746 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -309,5 +309,29 @@ EOF test_expect_success 'new variable inserts into proper section' 'cmp .git/config expect' +cat > other-config << EOF +[ein] + bahn = strasse +EOF + +cat > expect << EOF +ein.bahn=strasse +EOF + +GIT_CONFIG=other-config git-repo-config -l > output + +test_expect_success 'alternative GIT_CONFIG' 'cmp output expect' + +GIT_CONFIG=other-config git-repo-config anwohner.park ausweis + +cat > expect << EOF +[ein] + bahn = strasse +[anwohner] + park = ausweis +EOF + +test_expect_success '--set in alternative GIT_CONFIG' 'cmp other-config expect' + test_done -- cgit v1.2.3