From: Junio C Hamano Date: Wed, 10 Feb 2010 21:02:05 +0000 (-0800) Subject: Merge branch 'jh/maint-config-file-prefix' into maint X-Git-Tag: v1.6.6.2~6 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/b0e67fffb42059cc5dca6f58c376a2ffc5fb4520?hp=-c Merge branch 'jh/maint-config-file-prefix' into maint * jh/maint-config-file-prefix: builtin-config: Fix crash when using "-f " from non-root dir --- b0e67fffb42059cc5dca6f58c376a2ffc5fb4520 diff --combined builtin-config.c index a2d656edb3,5a5d214bb8..78724fbf7d --- a/builtin-config.c +++ b/builtin-config.c @@@ -316,8 -316,7 +316,8 @@@ int cmd_config(int argc, const char **a config_exclusive_filename = getenv(CONFIG_ENVIRONMENT); - argc = parse_options(argc, argv, builtin_config_options, builtin_config_usage, + argc = parse_options(argc, argv, prefix, builtin_config_options, + builtin_config_usage, PARSE_OPT_STOP_AT_NON_OPTION); if (use_global_config + use_system_config + !!given_config_file > 1) { @@@ -340,7 -339,7 +340,7 @@@ 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; } @@@ -383,8 -382,8 +383,8 @@@ check_argc(argc, 0, 0); if (git_config(show_all_config, NULL) < 0) { if (config_exclusive_filename) - die("unable to read config file %s: %s", - config_exclusive_filename, strerror(errno)); + die_errno("unable to read config file '%s'", + config_exclusive_filename); else die("error processing config file(s)"); } diff --combined t/t1300-repo-config.sh index 83b7294010,c81ccf2e56..9e74b1f141 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@@ -398,6 -398,17 +398,17 @@@ test_expect_success 'alternative GIT_CO 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 @@@ -459,28 -470,6 +470,28 @@@ EO test_expect_success "rename succeeded" "test_cmp expect .git/config" +cat >> .git/config << EOF +[branch "vier"] z = 1 +EOF + +test_expect_success "rename a section with a var on the same line" \ + 'git config --rename-section branch.vier branch.zwei' + +cat > expect << EOF +# Hallo + #Bello +[branch "zwei"] + x = 1 +[branch "zwei"] + y = 1 +[branch "drei"] +weird +[branch "zwei"] + z = 1 +EOF + +test_expect_success "rename succeeded" "test_cmp expect .git/config" + cat >> .git/config << EOF [branch "zwei"] a = 1 [branch "vier"] EOF @@@ -755,11 -744,6 +766,11 @@@ echo >>resul test_expect_success '--null --get-regexp' 'cmp result expect' +test_expect_success 'inner whitespace kept verbatim' ' + git config section.val "foo bar" && + test "z$(git config section.val)" = "zfoo bar" +' + test_expect_success SYMLINKS 'symlinked configuration' ' ln -s notyet myconfig &&