{"thread":{"id":"54922","subject":"[PATCH 0/3] t1300: minor cleanups","startedAt":"2021-01-03T09:38:37Z","lastAt":"2021-01-06T06:06:22Z","messageCount":5,"participants":["Martin Ågren","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"413330","messageId":"20210103093649.2221-1-martin.agren@gmail.com","threadId":"54922","inReplyTo":null,"subject":"[PATCH 0/3] t1300: minor cleanups","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2021-01-03T09:36:45Z","receivedAt":"2021-01-03T09:38:37Z","isPatch":true,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"There was some discussion around t1300 a while back and how it could\nneed some major cleanup [1]. This patch series is not that. I'll post an\nRFC series on that later. These initial cleanups -- or something like\nthem -- should be useful regardless of the fate of that future RFC, so\nI'm posting them early.\n\n[1] https://lore.kernel.org/git/xmqqlfeuqd8d.fsf@gitster.c.googlers.com/\n\nMartin Ågren (3):\n  t1300: remove duplicate test for `--file ../foo`\n  t1300: remove duplicate test for `--file no-such-file`\n  t1300: don't needlessly work with `core.foo` configs\n\n t/t1300-config.sh | 72 +++++++++++++++++++++--------------------------\n 1 file changed, 32 insertions(+), 40 deletions(-)\n\n-- \n2.30.0\n\n"},{"id":"413331","messageId":"20210103093649.2221-2-martin.agren@gmail.com","threadId":"54922","inReplyTo":"20210103093649.2221-1-martin.agren@gmail.com","subject":"[PATCH 1/3] t1300: remove duplicate test for `--file ../foo`","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2021-01-03T09:36:46Z","receivedAt":"2021-01-03T09:38:38Z","isPatch":true,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"We have two tests for checking that we can handle `git config --file\n../other-config ...`. One, using `--file`, was introduced in 65807ee697\n(\"builtin-config: Fix crash when using \"-f <relative path>\" from\nnon-root dir\", 2010-01-26), then another, using `GIT_CONFIG`, came about\nin 270a34438b (\"config: stop using config_exclusive_filename\",\n2012-02-16).\n\nThe latter of these was then converted to use `--file` in f7e8714101\n(\"t: prefer \"git config --file\" to GIT_CONFIG\", 2014-03-20). Both where\nthen simplified in a5db0b77b9 (\"t1300: extract and use\ntest_cmp_config()\", 2018-10-21).\n\nThese two tests differ slightly in the order of the options used, but\nother than that, they are identical. Let's drop one. As noted in\nf7e8714101, we do still have a test for `GIT_CONFIG` and it shares the\nimplementation with `--file`.\n\nSigned-off-by: Martin Ågren <martin.agren@gmail.com>\n---\n t/t1300-config.sh | 4 ----\n 1 file changed, 4 deletions(-)\n\ndiff --git a/t/t1300-config.sh b/t/t1300-config.sh\nindex 97a04c6cc2..302821fb02 100755\n--- a/t/t1300-config.sh\n+++ b/t/t1300-config.sh\n@@ -506,10 +506,6 @@ test_expect_success 'editing stdin is an error' '\n \n test_expect_success 'refer config from subdirectory' '\n \tmkdir x &&\n-\ttest_cmp_config -C x strasse --get --file ../other-config ein.bahn\n-'\n-\n-test_expect_success 'refer config from subdirectory via --file' '\n \ttest_cmp_config -C x strasse --file=../other-config --get ein.bahn\n '\n \n-- \n2.30.0\n\n"},{"id":"413332","messageId":"20210103093649.2221-3-martin.agren@gmail.com","threadId":"54922","inReplyTo":"20210103093649.2221-1-martin.agren@gmail.com","subject":"[PATCH 2/3] t1300: remove duplicate test for `--file no-such-file`","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2021-01-03T09:36:47Z","receivedAt":"2021-01-03T09:38:38Z","isPatch":true,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"We test that we can handle `git config --file symlink` and the error\ncase of `git config --file symlink-to-missing-file`. For good measure,\nwe also throw in a test to check that we correctly handle referencing a\nmissing regular file. But we have such a test earlier in this script.\nThey both check that we fail to use `--file no-such-file --list`.\n\nDrop the latter of these and keep the one that is in the general area\nwhere we test `--file` and `GIT_CONFIG`. The one we're dropping also\nchecks that we can't even get a specific key from the missing file --\nlet's make sure we check that in the test we keep.\n\nSigned-off-by: Martin Ågren <martin.agren@gmail.com>\n---\n t/t1300-config.sh | 8 ++------\n 1 file changed, 2 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t1300-config.sh b/t/t1300-config.sh\nindex 302821fb02..1439d870d6 100755\n--- a/t/t1300-config.sh\n+++ b/t/t1300-config.sh\n@@ -469,7 +469,8 @@ test_expect_success 'new variable inserts into proper section' '\n '\n \n test_expect_success 'alternative --file (non-existing file should fail)' '\n-\ttest_must_fail git config --file non-existing-config -l\n+\ttest_must_fail git config --file non-existing-config -l &&\n+\ttest_must_fail git config --file non-existing-config test.xyzzy\n '\n \n cat > other-config << EOF\n@@ -1032,11 +1033,6 @@ test_expect_success SYMLINKS 'symlinked configuration' '\n \ttest_cmp expect actual\n '\n \n-test_expect_success 'nonexistent configuration' '\n-\ttest_must_fail git config --file=doesnotexist --list &&\n-\ttest_must_fail git config --file=doesnotexist test.xyzzy\n-'\n-\n test_expect_success SYMLINKS 'symlink to nonexistent configuration' '\n \tln -s doesnotexist linktonada &&\n \tln -s linktonada linktolinktonada &&\n-- \n2.30.0\n\n"},{"id":"413333","messageId":"20210103093649.2221-4-martin.agren@gmail.com","threadId":"54922","inReplyTo":"20210103093649.2221-1-martin.agren@gmail.com","subject":"[PATCH 3/3] t1300: don't needlessly work with `core.foo` configs","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2021-01-03T09:36:48Z","receivedAt":"2021-01-03T09:39:05Z","isPatch":true,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"We use various made-up config keys in the \"core\" section for no real\nreason. Change them to work in the \"section\" section instead and be\ncareful to also change \"cores\" to \"sections\". Make sure to also catch\n\"Core\", \"CoReS\" and similar.\n\nThere are a few instances that actually want to work with a real \"core\"\nconfig such as `core.bare` or `core.editor`. After this, it's clearer\nthat they work with \"core\" for a reason.\n\nReported-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Martin Ågren <martin.agren@gmail.com>\n---\n t/t1300-config.sh | 60 +++++++++++++++++++++++------------------------\n 1 file changed, 30 insertions(+), 30 deletions(-)\n\ndiff --git a/t/t1300-config.sh b/t/t1300-config.sh\nindex 1439d870d6..1a4156c704 100755\n--- a/t/t1300-config.sh\n+++ b/t/t1300-config.sh\n@@ -12,75 +12,75 @@ test_expect_success 'clear default config' '\n '\n \n cat > expect << EOF\n-[core]\n+[section]\n \tpenguin = little blue\n EOF\n test_expect_success 'initial' '\n-\tgit config core.penguin \"little blue\" &&\n+\tgit config section.penguin \"little blue\" &&\n \ttest_cmp expect .git/config\n '\n \n cat > expect << EOF\n-[core]\n+[section]\n \tpenguin = little blue\n \tMovie = BadPhysics\n EOF\n test_expect_success 'mixed case' '\n-\tgit config Core.Movie BadPhysics &&\n+\tgit config Section.Movie BadPhysics &&\n \ttest_cmp expect .git/config\n '\n \n cat > expect << EOF\n-[core]\n+[section]\n \tpenguin = little blue\n \tMovie = BadPhysics\n-[Cores]\n+[Sections]\n \tWhatEver = Second\n EOF\n test_expect_success 'similar section' '\n-\tgit config Cores.WhatEver Second &&\n+\tgit config Sections.WhatEver Second &&\n \ttest_cmp expect .git/config\n '\n \n cat > expect << EOF\n-[core]\n+[section]\n \tpenguin = little blue\n \tMovie = BadPhysics\n \tUPPERCASE = true\n-[Cores]\n+[Sections]\n \tWhatEver = Second\n EOF\n test_expect_success 'uppercase section' '\n-\tgit config CORE.UPPERCASE true &&\n+\tgit config SECTION.UPPERCASE true &&\n \ttest_cmp expect .git/config\n '\n \n test_expect_success 'replace with non-match' '\n-\tgit config core.penguin kingpin !blue\n+\tgit config section.penguin kingpin !blue\n '\n \n test_expect_success 'replace with non-match (actually matching)' '\n-\tgit config core.penguin \"very blue\" !kingpin\n+\tgit config section.penguin \"very blue\" !kingpin\n '\n \n cat > expect << EOF\n-[core]\n+[section]\n \tpenguin = very blue\n \tMovie = BadPhysics\n \tUPPERCASE = true\n \tpenguin = kingpin\n-[Cores]\n+[Sections]\n \tWhatEver = Second\n EOF\n \n test_expect_success 'non-match result' 'test_cmp expect .git/config'\n \n test_expect_success 'find mixed-case key by canonical name' '\n-\ttest_cmp_config Second cores.whatever\n+\ttest_cmp_config Second sections.whatever\n '\n \n test_expect_success 'find mixed-case key by non-canonical name' '\n-\ttest_cmp_config Second CoReS.WhAtEvEr\n+\ttest_cmp_config Second SeCtIoNs.WhAtEvEr\n '\n \n test_expect_success 'subsections are not canonicalized by git-config' '\n@@ -1057,12 +1057,12 @@ test_expect_success 'git -c \"key=value\" support' '\n \ttrue\n \tEOF\n \t{\n-\t\tgit -c core.name=value config core.name &&\n+\t\tgit -c section.name=value config section.name &&\n \t\tgit -c foo.CamelCase=value config foo.camelcase &&\n \t\tgit -c foo.flag config --bool foo.flag\n \t} >actual &&\n \ttest_cmp expect actual &&\n-\ttest_must_fail git -c name=value config core.name\n+\ttest_must_fail git -c name=value config section.name\n '\n \n # We just need a type-specifier here that cares about the\n@@ -1107,7 +1107,7 @@ test_expect_success 'aliases can be CamelCased' '\n \n test_expect_success 'git -c does not split values on equals' '\n \techo \"value with = in it\" >expect &&\n-\tgit -c core.foo=\"value with = in it\" config core.foo >actual &&\n+\tgit -c section.foo=\"value with = in it\" config section.foo >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -1838,53 +1838,53 @@ do\n done\n \n cat >.git/config <<-\\EOF &&\n-[core]\n+[section]\n foo = true\n number = 10\n big = 1M\n EOF\n \n test_expect_success 'identical modern --type specifiers are allowed' '\n-\ttest_cmp_config 1048576 --type=int --type=int core.big\n+\ttest_cmp_config 1048576 --type=int --type=int section.big\n '\n \n test_expect_success 'identical legacy --type specifiers are allowed' '\n-\ttest_cmp_config 1048576 --int --int core.big\n+\ttest_cmp_config 1048576 --int --int section.big\n '\n \n test_expect_success 'identical mixed --type specifiers are allowed' '\n-\ttest_cmp_config 1048576 --int --type=int core.big\n+\ttest_cmp_config 1048576 --int --type=int section.big\n '\n \n test_expect_success 'non-identical modern --type specifiers are not allowed' '\n-\ttest_must_fail git config --type=int --type=bool core.big 2>error &&\n+\ttest_must_fail git config --type=int --type=bool section.big 2>error &&\n \ttest_i18ngrep \"only one type at a time\" error\n '\n \n test_expect_success 'non-identical legacy --type specifiers are not allowed' '\n-\ttest_must_fail git config --int --bool core.big 2>error &&\n+\ttest_must_fail git config --int --bool section.big 2>error &&\n \ttest_i18ngrep \"only one type at a time\" error\n '\n \n test_expect_success 'non-identical mixed --type specifiers are not allowed' '\n-\ttest_must_fail git config --type=int --bool core.big 2>error &&\n+\ttest_must_fail git config --type=int --bool section.big 2>error &&\n \ttest_i18ngrep \"only one type at a time\" error\n '\n \n test_expect_success '--type allows valid type specifiers' '\n-\ttest_cmp_config true  --type=bool core.foo\n+\ttest_cmp_config true  --type=bool section.foo\n '\n \n test_expect_success '--no-type unsets type specifiers' '\n-\ttest_cmp_config 10 --type=bool --no-type core.number\n+\ttest_cmp_config 10 --type=bool --no-type section.number\n '\n \n test_expect_success 'unset type specifiers may be reset to conflicting ones' '\n-\ttest_cmp_config 1048576 --type=bool --no-type --type=int core.big\n+\ttest_cmp_config 1048576 --type=bool --no-type --type=int section.big\n '\n \n test_expect_success '--type rejects unknown specifiers' '\n-\ttest_must_fail git config --type=nonsense core.foo 2>error &&\n+\ttest_must_fail git config --type=nonsense section.foo 2>error &&\n \ttest_i18ngrep \"unrecognized --type argument\" error\n '\n \n-- \n2.30.0\n\n"},{"id":"413534","messageId":"xmqqeeiyvbvh.fsf@gitster.c.googlers.com","threadId":"54922","inReplyTo":"20210103093649.2221-1-martin.agren@gmail.com","subject":"Re: [PATCH 0/3] t1300: minor cleanups","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-01-06T06:05:22Z","receivedAt":"2021-01-06T06:06:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin Ågren <martin.agren@gmail.com> writes:\n\n> There was some discussion around t1300 a while back and how it could\n> need some major cleanup [1]. This patch series is not that. I'll post an\n> RFC series on that later. These initial cleanups -- or something like\n> them -- should be useful regardless of the fate of that future RFC, so\n> I'm posting them early.\n>\n> [1] https://lore.kernel.org/git/xmqqlfeuqd8d.fsf@gitster.c.googlers.com/\n>\n> Martin Ågren (3):\n>   t1300: remove duplicate test for `--file ../foo`\n>   t1300: remove duplicate test for `--file no-such-file`\n>   t1300: don't needlessly work with `core.foo` configs\n>\n>  t/t1300-config.sh | 72 +++++++++++++++++++++--------------------------\n>  1 file changed, 32 insertions(+), 40 deletions(-)\n\nAll look sensible.  Thanks.\n"}]}