{"thread":{"id":"44190","subject":"[PATCH v2 0/9] allow customizing /etc/gitconfig location with an environment","startedAt":"2016-09-29T21:00:23Z","lastAt":"2016-09-29T21:00:51Z","messageCount":10,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":9},"messages":[{"id":"302933","messageId":"20160929210014.3874-1-gitster@pobox.com","threadId":"44190","inReplyTo":null,"subject":"[PATCH v2 0/9] allow customizing /etc/gitconfig location with an environment","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-29T21:00:05Z","receivedAt":"2016-09-29T21:00:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This ended up growing quite a bit, and I mostly hate it.\n\n - Patch 1 introduces GIT_CONFIG_SYSTEM_PATH environment variable\n   that lets you point at a file other than /etc/gitconfig to\n   pretend that your file is the system-wide configuration.\n\n - Patch 2 is a small bugfix.\n\n - Patches 3-7 are updates to 1300 and 1308, i.e. tests for \"git\n   config\", to make them more robust, in preparation for using\n   GIT_CONFIG_SYSTEM_PATH mechanism to point at a file during the\n   test.  It protects them a bit more than necessary in that the\n   variables some of the tests they use when they try to see the\n   output from \"git config --get\" are unlikely to appear in the fake\n   system-wide configuration during the test (hence disabling the\n   fake system-wide configuration has no practical effect), but\n   nevertheless the calls are protected by explicitly telling them\n   to read only from --local configuration file to future-proof\n   them.\n\n - Patch 8 is queued elsewhere already.\n\n - Patch 9 raises the default core.abbrev to 12 and countermands it\n   by setting it to 7 in a fake system-wide configuration file\n   during our test.  The unconditional widening of the default\n   abbreviation size in this patch will have to be discarded,\n   preferring the approach Linus is taking to auto-size it based on\n   the number of objects in the repository, but the part that\n   updates the test script may still be necessary.\n\nJeff King (1):\n  t1300: check also system-wide configuration file in --show-origin\n    tests\n\nJunio C Hamano (8):\n  config: allow customizing /etc/gitconfig location with an environment\n  t1300: always compare expect to actual\n  t1308: ignore system-wide config in the iteration test\n  t1300: disable system-wide config for tests that wants to read from -c\n  t1300: take contents of system-wide configuration into account in\n    \"--list\" test\n  t1300: be explicit in local configuration tests\n  worktree: honor configuration variables\n  core.abbrev: raise the default abbreviation to 12 hexdigits\n\n builtin/worktree.c     |   2 +\n cache.h                |   1 +\n config.c               |   2 +\n environment.c          |   2 +-\n t/gitconfig-for-test   |   9 ++++\n t/t1300-repo-config.sh | 120 ++++++++++++++++++++++++++++++-------------------\n t/t1308-config-set.sh  |   1 +\n t/test-lib.sh          |   4 +-\n 8 files changed, 93 insertions(+), 48 deletions(-)\n create mode 100644 t/gitconfig-for-test\n\n-- \n2.10.0-589-g5adf4e1\n\n"},{"id":"302934","messageId":"20160929210014.3874-2-gitster@pobox.com","threadId":"44190","inReplyTo":"20160929210014.3874-1-gitster@pobox.com","subject":"[PATCH v2 1/9] config: allow customizing /etc/gitconfig location with an environment","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-29T21:00:06Z","receivedAt":"2016-09-29T21:00:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"We introduced GIT_CONFIG_NOSYSTEM environment variable at ab88c363\n(\"allow suppressing of global and system config\", 2008-02-06),\nprimarily to protect our tests from random set of configuration\nvariables the system administrators would put in /etc/gitconfig\nfile.\n\nIntroduce a new environment variable GIT_CONFIG_SYSTEM_PATH, and allow\nthe users to specify a file that is used instead of /etc/gitconfig\nto read (and write) the system-wide configuration.  By doing so, we\ncan force our tests to honor certain configuration settings by\ndefault by pointing GIT_CONFIG_SYSTEM_PATH at our own, in addition to the\nexisting GIT_CONFIG_NOSYSTEM mechanism.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n cache.h                |  1 +\n config.c               |  2 ++\n t/gitconfig-for-test   |  6 ++++++\n t/t1300-repo-config.sh | 15 +++++++++++++++\n t/test-lib.sh          |  4 ++--\n 5 files changed, 26 insertions(+), 2 deletions(-)\n create mode 100644 t/gitconfig-for-test\n\ndiff --git a/cache.h b/cache.h\nindex b0dae4bac1a1..d4b689f386d6 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -408,6 +408,7 @@ static inline enum object_type object_type(unsigned int mode)\n #define GIT_NAMESPACE_ENVIRONMENT \"GIT_NAMESPACE\"\n #define GIT_WORK_TREE_ENVIRONMENT \"GIT_WORK_TREE\"\n #define GIT_PREFIX_ENVIRONMENT \"GIT_PREFIX\"\n+#define GIT_CONFIG_SYSTEM_PATH_ENVIRONMENT \"GIT_CONFIG_SYSTEM_PATH\"\n #define DEFAULT_GIT_DIR_ENVIRONMENT \".git\"\n #define DB_ENVIRONMENT \"GIT_OBJECT_DIRECTORY\"\n #define INDEX_ENVIRONMENT \"GIT_INDEX_FILE\"\ndiff --git a/config.c b/config.c\nindex 0dfed682b868..096bb754aad7 100644\n--- a/config.c\n+++ b/config.c\n@@ -1253,6 +1253,8 @@ const char *git_etc_gitconfig(void)\n {\n \tstatic const char *system_wide;\n \tif (!system_wide)\n+\t\tsystem_wide = getenv(GIT_CONFIG_SYSTEM_PATH_ENVIRONMENT);\n+\tif (!system_wide)\n \t\tsystem_wide = system_path(ETC_GITCONFIG);\n \treturn system_wide;\n }\ndiff --git a/t/gitconfig-for-test b/t/gitconfig-for-test\nnew file mode 100644\nindex 000000000000..4598885ed5c3\n--- /dev/null\n+++ b/t/gitconfig-for-test\n@@ -0,0 +1,6 @@\n+;; This file is used as if it were /etc/gitconfig while running the\n+;; test scripts in this directory.\n+;;\n+;; [user]\n+;;\tname = A U Thor\n+;;\temail = author@example.com\ndiff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\nindex 923bfc5a2606..0543b62227bf 100755\n--- a/t/t1300-repo-config.sh\n+++ b/t/t1300-repo-config.sh\n@@ -1372,4 +1372,19 @@ test_expect_success !MINGW '--show-origin blob ref' '\n \ttest_cmp expect output\n '\n \n+test_expect_success 'system-wide configuration' '\n+\tsystem=\"$TRASH_DIRECTORY/system-wide\" &&\n+\t>\"$system\" &&\n+\tgit config -f \"$system\" --add frotz.nitfol xyzzy &&\n+\n+\tgit config -f \"$system\" frotz.nitfol >expect &&\n+\tGIT_CONFIG_SYSTEM_PATH=\"$system\" \\\n+\tgit config --system frotz.nitfol >actual &&\n+\n+\tGIT_CONFIG_SYSTEM_PATH=\"$system\" \\\n+\tgit config --system --replace-all frotz.nitfol blorb &&\n+\techo blorb >expect &&\n+\tGIT_CONFIG_SYSTEM_PATH=\"$system\" git config --system frotz.nitfol >actual\n+'\n+\n test_done\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex ac56512a1c5e..b811e4c70273 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -851,9 +851,9 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:\n \tfi\n fi\n GIT_TEMPLATE_DIR=\"$GIT_BUILD_DIR\"/templates/blt\n-GIT_CONFIG_NOSYSTEM=1\n+GIT_CONFIG_SYSTEM_PATH=\"$GIT_BUILD_DIR/t/gitconfig-for-test\"\n GIT_ATTR_NOSYSTEM=1\n-export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_ATTR_NOSYSTEM\n+export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_SYSTEM_PATH GIT_ATTR_NOSYSTEM\n \n if test -z \"$GIT_TEST_CMP\"\n then\n-- \n2.10.0-589-g5adf4e1\n\n"},{"id":"302935","messageId":"20160929210014.3874-3-gitster@pobox.com","threadId":"44190","inReplyTo":"20160929210014.3874-1-gitster@pobox.com","subject":"[PATCH v2 2/9] t1300: always compare expect to actual","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-29T21:00:07Z","receivedAt":"2016-09-29T21:00:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The two arguments to the test_cmp helper should always have the\nexpected output first and then the actual one, so that an unmet\nexpectation would appear as\n\n    -what we wanted to see\n    +what we actually saw\n\nin its output.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t1300-repo-config.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\nindex 0543b62227bf..1b3f6f4854f9 100755\n--- a/t/t1300-repo-config.sh\n+++ b/t/t1300-repo-config.sh\n@@ -936,7 +936,7 @@ EOF\n \n test_expect_success 'value continued on next line' '\n \tgit config --list > result &&\n-\ttest_cmp result expect\n+\ttest_cmp expect result\n '\n \n cat > .git/config <<\\EOF\n-- \n2.10.0-589-g5adf4e1\n\n"},{"id":"302936","messageId":"20160929210014.3874-4-gitster@pobox.com","threadId":"44190","inReplyTo":"20160929210014.3874-1-gitster@pobox.com","subject":"[PATCH v2 3/9] t1308: ignore system-wide config in the iteration test","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-29T21:00:08Z","receivedAt":"2016-09-29T21:00:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"We do not want to keep track of the exact contents of the fake\nsystem-wide t/gitconfig-for-test configuration file.  Keep ignoring\nit as we used to.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t1308-config-set.sh | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/t/t1308-config-set.sh b/t/t1308-config-set.sh\nindex 7655c94c2801..5d5adb1efd8e 100755\n--- a/t/t1308-config-set.sh\n+++ b/t/t1308-config-set.sh\n@@ -260,6 +260,7 @@ test_expect_success 'iteration shows correct origins' '\n \tname=\n \tscope=cmdline\n \tEOF\n+\tGIT_CONFIG_NOSYSTEM=1 \\\n \tGIT_CONFIG_PARAMETERS=$cmdline_config test-config iterate >actual &&\n \ttest_cmp expect actual\n '\n-- \n2.10.0-589-g5adf4e1\n\n"},{"id":"302937","messageId":"20160929210014.3874-5-gitster@pobox.com","threadId":"44190","inReplyTo":"20160929210014.3874-1-gitster@pobox.com","subject":"[PATCH v2 4/9] t1300: check also system-wide configuration file in --show-origin tests","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-29T21:00:09Z","receivedAt":"2016-09-29T21:00:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"From: Jeff King <peff@peff.net>\n\nBecause we used to run our tests with GIT_CONFIG_NOSYSTEM, these did\nnot test that the system-wide configuration file is also read and\nshown as one of the origins.  Create a custom/fake system-wide\nconfiguration file and make sure it appears in the output, using the\nnewly introduced GIT_CONFIG_SYSTEM_PATH mechanism.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t1300-repo-config.sh | 15 ++++++++++++++-\n 1 file changed, 14 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\nindex 1b3f6f4854f9..940469339bd2 100755\n--- a/t/t1300-repo-config.sh\n+++ b/t/t1300-repo-config.sh\n@@ -1236,6 +1236,11 @@ test_expect_success 'set up --show-origin tests' '\n \t\t[user]\n \t\t\trelative = include\n \tEOF\n+\tcat >\"$HOME\"/etc-gitconfig <<-\\EOF &&\n+\t\t[user]\n+\t\t\tsystem = true\n+\t\t\toverride = system\n+\tEOF\n \tcat >\"$HOME\"/.gitconfig <<-EOF &&\n \t\t[user]\n \t\t\tglobal = true\n@@ -1254,6 +1259,8 @@ test_expect_success 'set up --show-origin tests' '\n \n test_expect_success '--show-origin with --list' '\n \tcat >expect <<-EOF &&\n+\t\tfile:$HOME/etc-gitconfig\tuser.system=true\n+\t\tfile:$HOME/etc-gitconfig\tuser.override=system\n \t\tfile:$HOME/.gitconfig\tuser.global=true\n \t\tfile:$HOME/.gitconfig\tuser.override=global\n \t\tfile:$HOME/.gitconfig\tinclude.path=$INCLUDE_DIR/absolute.include\n@@ -1264,13 +1271,16 @@ test_expect_success '--show-origin with --list' '\n \t\tfile:.git/../include/relative.include\tuser.relative=include\n \t\tcommand line:\tuser.cmdline=true\n \tEOF\n+\tGIT_CONFIG_SYSTEM_PATH=$HOME/etc-gitconfig \\\n \tgit -c user.cmdline=true config --list --show-origin >output &&\n \ttest_cmp expect output\n '\n \n test_expect_success '--show-origin with --list --null' '\n \tcat >expect <<-EOF &&\n-\t\tfile:$HOME/.gitconfigQuser.global\n+\t\tfile:$HOME/etc-gitconfigQuser.system\n+\t\ttrueQfile:$HOME/etc-gitconfigQuser.override\n+\t\tsystemQfile:$HOME/.gitconfigQuser.global\n \t\ttrueQfile:$HOME/.gitconfigQuser.override\n \t\tglobalQfile:$HOME/.gitconfigQinclude.path\n \t\t$INCLUDE_DIR/absolute.includeQfile:$INCLUDE_DIR/absolute.includeQuser.absolute\n@@ -1281,6 +1291,7 @@ test_expect_success '--show-origin with --list --null' '\n \t\tincludeQcommand line:Quser.cmdline\n \t\ttrueQ\n \tEOF\n+\tGIT_CONFIG_SYSTEM_PATH=$HOME/etc-gitconfig \\\n \tgit -c user.cmdline=true config --null --list --show-origin >output.raw &&\n \tnul_to_q <output.raw >output &&\n \t# The here-doc above adds a newline that the --null output would not\n@@ -1304,6 +1315,7 @@ test_expect_success '--show-origin with --get-regexp' '\n \t\tfile:$HOME/.gitconfig\tuser.global true\n \t\tfile:.git/config\tuser.local true\n \tEOF\n+\tGIT_CONFIG_SYSTEM_PATH=$HOME/etc-gitconfig \\\n \tgit config --show-origin --get-regexp \"user\\.[g|l].*\" >output &&\n \ttest_cmp expect output\n '\n@@ -1312,6 +1324,7 @@ test_expect_success '--show-origin getting a single key' '\n \tcat >expect <<-\\EOF &&\n \t\tfile:.git/config\tlocal\n \tEOF\n+\tGIT_CONFIG_SYSTEM_PATH=$HOME/etc-gitconfig \\\n \tgit config --show-origin user.override >output &&\n \ttest_cmp expect output\n '\n-- \n2.10.0-589-g5adf4e1\n\n"},{"id":"302938","messageId":"20160929210014.3874-6-gitster@pobox.com","threadId":"44190","inReplyTo":"20160929210014.3874-1-gitster@pobox.com","subject":"[PATCH v2 5/9] t1300: disable system-wide config for tests that wants to read from -c","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-29T21:00:10Z","receivedAt":"2016-09-29T21:00:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This test wants to do\n\n\tgit -c x.two=2 config --get-regexp ^x\\.*\n\nand see x.two that came from the one-shot configuration in its\noutput.  This form cannot be limited with \"--local\", as it limits\nthe input to the local configuration file and makes these one-shot\nsettings ignored.  At this point, the test knows that there is no\nvariable that match x.* in its local configuration, and it also was\nOK to assume that there is nothing in the system-wide config or\nglobal one.\n\nMake sure that assumption holds by using the GIT_CONFIG_NOSYSTEM\nenvironment, as we may add anything to t/gitconfig-for-test later.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t1300-repo-config.sh | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\nindex 940469339bd2..95734034e0d5 100755\n--- a/t/t1300-repo-config.sh\n+++ b/t/t1300-repo-config.sh\n@@ -1093,6 +1093,7 @@ test_expect_success 'multiple git -c appends config' '\n \tx.one 1\n \tx.two 2\n \tEOF\n+\tGIT_CONFIG_NOSYSTEM=1 \\\n \tgit -c x.one=1 x >actual &&\n \ttest_cmp expect actual\n '\n-- \n2.10.0-589-g5adf4e1\n\n"},{"id":"302939","messageId":"20160929210014.3874-7-gitster@pobox.com","threadId":"44190","inReplyTo":"20160929210014.3874-1-gitster@pobox.com","subject":"[PATCH v2 6/9] t1300: take contents of system-wide configuration into account in \"--list\" test","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-29T21:00:11Z","receivedAt":"2016-09-29T21:00:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"One of the \"git config\" test tries to see that the command run\nwithout a valid repository still shows non-repository specific\nconfiguration.  As we are planning to later make the system-wide\nfile non-empty, prepare for the change by expecting to see the\ncontents from it.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t1300-repo-config.sh | 7 ++++---\n 1 file changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\nindex 95734034e0d5..2a15cd4d150d 100755\n--- a/t/t1300-repo-config.sh\n+++ b/t/t1300-repo-config.sh\n@@ -344,10 +344,11 @@ test_expect_success 'working --list' '\n \tgit config --list > output &&\n \ttest_cmp expect output\n '\n-cat > expect << EOF\n-EOF\n \n-test_expect_success '--list without repo produces empty output' '\n+test_expect_success '--list without repo shows only system-wide and global' '\n+\t# The global one aka $HOME/.gitconfig is missing,\n+\t# so we do not have to worry about it.\n+\tgit config --system --list >expect &&\n \tgit --git-dir=nonexistent config --list >output &&\n \ttest_cmp expect output\n '\n-- \n2.10.0-589-g5adf4e1\n\n"},{"id":"302940","messageId":"20160929210014.3874-8-gitster@pobox.com","threadId":"44190","inReplyTo":"20160929210014.3874-1-gitster@pobox.com","subject":"[PATCH v2 7/9] t1300: be explicit in local configuration tests","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-29T21:00:12Z","receivedAt":"2016-09-29T21:00:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Many tests in this script prepare variable settings in the\nrepository local configuration and expects \"--list\" to report only\nthe ones from the repository local configuration.\n\nThis happened to work while we were running out tests under\nGIT_CONFIG_NOSYSTEM and/or with an empty system-wide configuration\nfile, but as we will soon make our fake system-wide configuration\nnon-empty, prepare for that change by explicitly telling the command\nto look only at \"--local\" configuration.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t1300-repo-config.sh | 80 +++++++++++++++++++++++++-------------------------\n 1 file changed, 40 insertions(+), 40 deletions(-)\n\ndiff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\nindex 2a15cd4d150d..8979212946c0 100755\n--- a/t/t1300-repo-config.sh\n+++ b/t/t1300-repo-config.sh\n@@ -245,18 +245,18 @@ test_expect_success 'multivar' '\n '\n \n test_expect_success 'non-match' '\n-\tgit config --get nextsection.nonewline !for\n+\tgit config --local --get nextsection.nonewline !for\n '\n \n test_expect_success 'non-match value' '\n \techo wow >expect &&\n-\tgit config --get nextsection.nonewline !for >actual &&\n+\tgit config --local --get nextsection.nonewline !for >actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success 'multi-valued get returns final one' '\n \techo \"wow2 for me\" >expect &&\n-\tgit config --get nextsection.nonewline >actual &&\n+\tgit config --local --get nextsection.nonewline >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -265,7 +265,7 @@ test_expect_success 'multi-valued get-all returns all' '\n \twow\n \twow2 for me\n \tEOF\n-\tgit config --get-all nextsection.nonewline >actual &&\n+\tgit config --local --get-all nextsection.nonewline >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -341,7 +341,7 @@ version.1.2.3eX.alpha=beta\n EOF\n \n test_expect_success 'working --list' '\n-\tgit config --list > output &&\n+\tgit config --local --list > output &&\n \ttest_cmp expect output\n '\n \n@@ -361,7 +361,7 @@ version.1.2.3eX.alpha\n EOF\n \n test_expect_success '--name-only --list' '\n-\tgit config --name-only --list >output &&\n+\tgit config --local --name-only --list >output &&\n \ttest_cmp expect output\n '\n \n@@ -371,7 +371,7 @@ nextsection.nonewline wow2 for me\n EOF\n \n test_expect_success '--get-regexp' '\n-\tgit config --get-regexp in >output &&\n+\tgit config --local --get-regexp in >output &&\n \ttest_cmp expect output\n '\n \n@@ -381,7 +381,7 @@ nextsection.nonewline\n EOF\n \n test_expect_success '--name-only --get-regexp' '\n-\tgit config --name-only --get-regexp in >output &&\n+\tgit config --local --name-only --get-regexp in >output &&\n \ttest_cmp expect output\n '\n \n@@ -392,7 +392,7 @@ EOF\n \n test_expect_success '--add' '\n \tgit config --add nextsection.nonewline \"wow4 for you\" &&\n-\tgit config --get-all nextsection.nonewline > output &&\n+\tgit config --local --get-all nextsection.nonewline > output &&\n \ttest_cmp expect output\n '\n \n@@ -404,45 +404,45 @@ cat > .git/config << EOF\n EOF\n \n test_expect_success 'get variable with no value' '\n-\tgit config --get novalue.variable ^$\n+\tgit config --local --get novalue.variable ^$\n '\n \n test_expect_success 'get variable with empty value' '\n-\tgit config --get emptyvalue.variable ^$\n+\tgit config --local --get emptyvalue.variable ^$\n '\n \n echo novalue.variable > expect\n \n test_expect_success 'get-regexp variable with no value' '\n-\tgit config --get-regexp novalue > output &&\n+\tgit config --local --get-regexp novalue > output &&\n \ttest_cmp expect output\n '\n \n echo 'novalue.variable true' > expect\n \n test_expect_success 'get-regexp --bool variable with no value' '\n-\tgit config --bool --get-regexp novalue > output &&\n+\tgit config --local --bool --get-regexp novalue > output &&\n \ttest_cmp expect output\n '\n \n echo 'emptyvalue.variable ' > expect\n \n test_expect_success 'get-regexp variable with empty value' '\n-\tgit config --get-regexp emptyvalue > output &&\n+\tgit config --local --get-regexp emptyvalue > output &&\n \ttest_cmp expect output\n '\n \n echo true > expect\n \n test_expect_success 'get bool variable with no value' '\n-\tgit config --bool novalue.variable > output &&\n+\tgit config --local --bool novalue.variable > output &&\n \ttest_cmp expect output\n '\n \n echo false > expect\n \n test_expect_success 'get bool variable with empty value' '\n-\tgit config --bool emptyvalue.variable > output &&\n+\tgit config --local --bool emptyvalue.variable > output &&\n \ttest_cmp expect output\n '\n \n@@ -683,15 +683,15 @@ test_expect_success numbers '\n \tgit config mega.ton 1m &&\n \techo 1024 >expect &&\n \techo 1048576 >>expect &&\n-\tgit config --int --get kilo.gram >actual &&\n-\tgit config --int --get mega.ton >>actual &&\n+\tgit config --local --int --get kilo.gram >actual &&\n+\tgit config --local --int --get mega.ton >>actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success '--int is at least 64 bits' '\n \tgit config giga.watts 121g &&\n \techo 129922760704 >expect &&\n-\tgit config --int --get giga.watts >actual &&\n+\tgit config --local --int --get giga.watts >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -700,7 +700,7 @@ test_expect_success 'invalid unit' '\n \techo 1auto >expect &&\n \tgit config aninvalid.unit >actual &&\n \ttest_cmp expect actual &&\n-\ttest_must_fail git config --int --get aninvalid.unit 2>actual &&\n+\ttest_must_fail git config --local --int --get aninvalid.unit 2>actual &&\n \ttest_i18ngrep \"bad numeric config value .1auto. for .aninvalid.unit. in file .git/config: invalid unit\" actual\n '\n \n@@ -733,15 +733,15 @@ test_expect_success bool '\n \trm -f result &&\n \tfor i in 1 2 3 4\n \tdo\n-\t    git config --bool --get bool.true$i >>result\n-\t    git config --bool --get bool.false$i >>result\n+\t    git config --local --bool --get bool.true$i >>result\n+\t    git config --local --bool --get bool.false$i >>result\n         done &&\n \ttest_cmp expect result'\n \n test_expect_success 'invalid bool (--get)' '\n \n \tgit config bool.nobool foobar &&\n-\ttest_must_fail git config --bool --get bool.nobool'\n+\ttest_must_fail git config --local --bool --get bool.nobool'\n \n test_expect_success 'invalid bool (set)' '\n \n@@ -808,12 +808,12 @@ test_expect_success 'get --bool-or-int' '\n \t-1\n \tEOF\n \t{\n-\t\tgit config --bool-or-int bool.true1 &&\n-\t\tgit config --bool-or-int bool.true2 &&\n-\t\tgit config --bool-or-int bool.false &&\n-\t\tgit config --bool-or-int int.int1 &&\n-\t\tgit config --bool-or-int int.int2 &&\n-\t\tgit config --bool-or-int int.int3\n+\t\tgit config --local --bool-or-int bool.true1 &&\n+\t\tgit config --local --bool-or-int bool.true2 &&\n+\t\tgit config --local --bool-or-int bool.false &&\n+\t\tgit config --local --bool-or-int int.int1 &&\n+\t\tgit config --local --bool-or-int int.int2 &&\n+\t\tgit config --local --bool-or-int int.int3\n \t} >actual &&\n \ttest_cmp expect actual\n '\n@@ -868,9 +868,9 @@ foo~\n EOF\n \n test_expect_success HOMEVAR 'get --path' '\n-\tgit config --get --path path.home > result &&\n-\tgit config --get --path path.normal >> result &&\n-\tgit config --get --path path.trailingtilde >> result &&\n+\tgit config --local --get --path path.home > result &&\n+\tgit config --local --get --path path.normal >> result &&\n+\tgit config --local --get --path path.trailingtilde >> result &&\n \ttest_cmp expect result\n '\n \n@@ -882,10 +882,10 @@ EOF\n test_expect_success !MINGW 'get --path copes with unset $HOME' '\n \t(\n \t\tunset HOME;\n-\t\ttest_must_fail git config --get --path path.home \\\n+\t\ttest_must_fail git config --local --get --path path.home \\\n \t\t\t>result 2>msg &&\n-\t\tgit config --get --path path.normal >>result &&\n-\t\tgit config --get --path path.trailingtilde >>result\n+\t\tgit config --local --get --path path.normal >>result &&\n+\t\tgit config --local --get --path path.trailingtilde >>result\n \t) &&\n \ttest_i18ngrep \"[Ff]ailed to expand.*~/\" msg &&\n \ttest_cmp expect result\n@@ -893,7 +893,7 @@ test_expect_success !MINGW 'get --path copes with unset $HOME' '\n \n test_expect_success 'get --path barfs on boolean variable' '\n \techo \"[path]bool\" >.git/config &&\n-\ttest_must_fail git config --get --path path.bool\n+\ttest_must_fail git config --local --get --path path.bool\n '\n \n cat > expect << EOF\n@@ -936,7 +936,7 @@ section.quotecont=cont;inued\n EOF\n \n test_expect_success 'value continued on next line' '\n-\tgit config --list > result &&\n+\tgit config --local --list > result &&\n \ttest_cmp expect result\n '\n \n@@ -960,14 +960,14 @@ Qsection.sub=section.val4\n Qsection.sub=section.val5Q\n EOF\n test_expect_success '--null --list' '\n-\tgit config --null --list >result.raw &&\n+\tgit config --local --null --list >result.raw &&\n \tnul_to_q <result.raw >result &&\n \techo >>result &&\n \ttest_cmp expect result\n '\n \n test_expect_success '--null --get-regexp' '\n-\tgit config --null --get-regexp \"val[0-9]\" >result.raw &&\n+\tgit config --local --null --get-regexp \"val[0-9]\" >result.raw &&\n \tnul_to_q <result.raw >result &&\n \techo >>result &&\n \ttest_cmp expect result\n@@ -1127,7 +1127,7 @@ test_expect_success 'barf on syntax error' '\n \t[section]\n \tkey garbage\n \tEOF\n-\ttest_must_fail git config --get section.key >actual 2>error &&\n+\ttest_must_fail git config --local --get section.key >actual 2>error &&\n \ttest_i18ngrep \" line 3 \" error\n '\n \n-- \n2.10.0-589-g5adf4e1\n\n"},{"id":"302941","messageId":"20160929210014.3874-9-gitster@pobox.com","threadId":"44190","inReplyTo":"20160929210014.3874-1-gitster@pobox.com","subject":"[PATCH v2 8/9] worktree: honor configuration variables","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-29T21:00:13Z","receivedAt":"2016-09-29T21:00:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The command accesses default_abbrev (defined in environment.c and is\nupdated via core.abbrev configuration), but never makes any call to\ngit_config().  The output from \"worktree list\" ignores the abbrev\nsetting for this reason.\n\nMake a call to git_config() to read the default set of configuration\nvariables at the beginning of the command.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/worktree.c | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex 6dcf7bd9d270..5c4854d3e4a6 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -528,6 +528,8 @@ int cmd_worktree(int ac, const char **av, const char *prefix)\n \t\tOPT_END()\n \t};\n \n+\tgit_config(git_default_config, NULL);\n+\n \tif (ac < 2)\n \t\tusage_with_options(worktree_usage, options);\n \tif (!prefix)\n-- \n2.10.0-589-g5adf4e1\n\n"},{"id":"302942","messageId":"20160929210014.3874-10-gitster@pobox.com","threadId":"44190","inReplyTo":"20160929210014.3874-1-gitster@pobox.com","subject":"[PATCH v2 9/9] core.abbrev: raise the default abbreviation to 12 hexdigits","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-29T21:00:14Z","receivedAt":"2016-09-29T21:00:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"As Peff said, responding in a thread started by Linus's suggestion\nto raise the default abbreviation to 12 hexdigits:\n\n    I actually think \"12\" might be sane for a long time. That's 48\n    bits of sha1, so we'd expect a 50% chance of a single collision\n    at 2^24, or 16 million.  The biggest repository I know about (in\n    number of objects) is the one holding all of the objects for all\n    of the forks of torvalds/linux on GitHub. It's at about 15\n    million objects.\n\n    Which seems close, but remember that's the size where we expect\n    to see a single collision. They don't become common until much\n    later (I didn't compute an exact number, but Linus's 16x sounds\n    about right). I know that the growth of the kernel isn't really\n    linear, but I think the need to bump to \"13\" might not just be\n    decades, but possibly a century or more.\n\n    So 12 seems reasonable, and the only downside for it (or for \"13\", for\n    that matter) is a few extra bytes. I dunno, maybe people will really\n    hate that, but I have a feeling these are mostly cut-and-pasted anyway.\n\nAnd this does exactly that.\n\nKeep the tests working by explicitly asking for the old 7 hexdigits\nsetting in the fake system-wide configuration file used for tests.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n environment.c        | 2 +-\n t/gitconfig-for-test | 3 +++\n 2 files changed, 4 insertions(+), 1 deletion(-)\n\ndiff --git a/environment.c b/environment.c\nindex ca72464a9850..25daddbc13d6 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -16,7 +16,7 @@ int trust_executable_bit = 1;\n int trust_ctime = 1;\n int check_stat = 1;\n int has_symlinks = 1;\n-int minimum_abbrev = 4, default_abbrev = 7;\n+int minimum_abbrev = 4, default_abbrev = 12;\n int ignore_case;\n int assume_unchanged;\n int prefer_symlink_refs;\ndiff --git a/t/gitconfig-for-test b/t/gitconfig-for-test\nindex 4598885ed5c3..8c284425d725 100644\n--- a/t/gitconfig-for-test\n+++ b/t/gitconfig-for-test\n@@ -4,3 +4,6 @@\n ;; [user]\n ;;\tname = A U Thor\n ;;\temail = author@example.com\n+\n+[core]\n+\tabbrev = 7\n-- \n2.10.0-589-g5adf4e1\n\n"}]}