{"thread":{"id":"20221","subject":"[PATCH 0/2] Section renaming can lose content","startedAt":"2009-07-24T21:21:42Z","lastAt":"2009-07-26T20:24:37Z","messageCount":17,"participants":["Alex Vandiver","Nanako Shiraishi","Junio C Hamano","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"118657","messageId":"1248470504-16326-1-git-send-email-alex@chmrr.net","threadId":"20221","inReplyTo":null,"subject":"[PATCH 0/2] Section renaming can lose content","fromName":"Alex Vandiver","fromEmail":"alex@chmrr.net","sentAt":"2009-07-24T21:21:42Z","receivedAt":"2009-07-24T21:21:42Z","isPatch":true,"sender":{"key":"alex@chmrr.net","avatar":"https://avatars.githubusercontent.com/u/28347?v=4"},"body":"I submitted a patch to the testfile on the 8th; what follows is a pass\nat solving the underlying bug as well.\n - Alex\n"},{"id":"118659","messageId":"1248470504-16326-2-git-send-email-alex@chmrr.net","threadId":"20221","inReplyTo":"1248470504-16326-1-git-send-email-alex@chmrr.net","subject":"[PATCH 1/2] Make section_name_match start on '[', and return the length on success","fromName":"Alex Vandiver","fromEmail":"alex@chmrr.net","sentAt":"2009-07-24T21:21:43Z","receivedAt":"2009-07-24T21:21:43Z","isPatch":true,"sender":{"key":"alex@chmrr.net","avatar":"https://avatars.githubusercontent.com/u/28347?v=4"},"body":"\nSigned-off-by: Alex Vandiver <alex@chmrr.net>\n---\n config.c |   19 ++++++++++++++++---\n 1 files changed, 16 insertions(+), 3 deletions(-)\n\ndiff --git a/config.c b/config.c\nindex 04380bb..7d6f6f6 100644\n--- a/config.c\n+++ b/config.c\n@@ -1194,7 +1194,9 @@ write_err_out:\n static int section_name_match (const char *buf, const char *name)\n {\n \tint i = 0, j = 0, dot = 0;\n-\tfor (; buf[i] && buf[i] != ']'; i++) {\n+\tif (buf[i] != '[')\n+\t\treturn 0;\n+\tfor (i = 1; buf[i] && buf[i] != ']'; i++) {\n \t\tif (!dot && isspace(buf[i])) {\n \t\t\tdot = 1;\n \t\t\tif (name[j++] != '.')\n@@ -1215,7 +1217,17 @@ static int section_name_match (const char *buf, const char *name)\n \t\tif (buf[i] != name[j++])\n \t\t\tbreak;\n \t}\n-\treturn (buf[i] == ']' && name[j] == 0);\n+\tif (buf[i] == ']' && name[j] == 0) {\n+\t\t/*\n+\t\t * We match, now just find the right length offset by\n+\t\t * gobbling up any whitespace after it, as well\n+\t\t */\n+\t\ti++;\n+\t\tfor (; buf[i] && isspace(buf[i]); i++)\n+\t\t\t; /* do nothing */\n+\t\treturn i;\n+\t}\n+\treturn 0;\n }\n \n /* if new_name == NULL, the section is removed instead */\n@@ -1249,7 +1261,8 @@ int git_config_rename_section(const char *old_name, const char *new_name)\n \t\t\t; /* do nothing */\n \t\tif (buf[i] == '[') {\n \t\t\t/* it's a section */\n-\t\t\tif (section_name_match (&buf[i+1], old_name)) {\n+\t\t\tint offset = section_name_match (&buf[i], old_name);\n+\t\t\tif (offset > 0) {\n \t\t\t\tret++;\n \t\t\t\tif (new_name == NULL) {\n \t\t\t\t\tremove = 1;\n-- \n1.6.3.3.473.gb74fc4.dirty\n"},{"id":"118658","messageId":"1248470504-16326-3-git-send-email-alex@chmrr.net","threadId":"20221","inReplyTo":"1248470504-16326-2-git-send-email-alex@chmrr.net","subject":"[PATCH 2/2] After renaming a section, print any trailing variable definitions","fromName":"Alex Vandiver","fromEmail":"alex@chmrr.net","sentAt":"2009-07-24T21:21:44Z","receivedAt":"2009-07-24T21:21:44Z","isPatch":true,"sender":{"key":"alex@chmrr.net","avatar":"https://avatars.githubusercontent.com/u/28347?v=4"},"body":"\nSigned-off-by: Alex Vandiver <alex@chmrr.net>\n---\n config.c               |   22 +++++++++++++++++++---\n t/t1300-repo-config.sh |   22 ++++++++++++++++++++++\n 2 files changed, 41 insertions(+), 3 deletions(-)\n\ndiff --git a/config.c b/config.c\nindex 7d6f6f6..3a2965e 100644\n--- a/config.c\n+++ b/config.c\n@@ -1257,6 +1257,7 @@ int git_config_rename_section(const char *old_name, const char *new_name)\n \twhile (fgets(buf, sizeof(buf), config_file)) {\n \t\tint i;\n \t\tint length;\n+\t\tchar* output = buf;\n \t\tfor (i = 0; buf[i] && isspace(buf[i]); i++)\n \t\t\t; /* do nothing */\n \t\tif (buf[i] == '[') {\n@@ -1273,14 +1274,29 @@ int git_config_rename_section(const char *old_name, const char *new_name)\n \t\t\t\t\tret = write_error(lock->filename);\n \t\t\t\t\tgoto out;\n \t\t\t\t}\n-\t\t\t\tcontinue;\n+\t\t\t\t/*\n+\t\t\t\t * We wrote out the new section, with\n+\t\t\t\t * a newline, now skip the old\n+\t\t\t\t * section's length\n+\t\t\t\t */\n+\t\t\t\toutput += offset + i;\n+\t\t\t\tif (strlen(output) > 0) {\n+\t\t\t\t\t/*\n+\t\t\t\t\t * More content means there's\n+\t\t\t\t\t * a declaration to put on the\n+\t\t\t\t\t * next line; indent with a\n+\t\t\t\t\t * tab\n+\t\t\t\t\t */\n+\t\t\t\t\toutput -= 1;\n+\t\t\t\t\toutput[0] = '\\t';\n+\t\t\t\t}\n \t\t\t}\n \t\t\tremove = 0;\n \t\t}\n \t\tif (remove)\n \t\t\tcontinue;\n-\t\tlength = strlen(buf);\n-\t\tif (write_in_full(out_fd, buf, length) != length) {\n+\t\tlength = strlen(output);\n+\t\tif (write_in_full(out_fd, output, length) != length) {\n \t\t\tret = write_error(lock->filename);\n \t\t\tgoto out;\n \t\t}\ndiff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\nindex 43ea283..8c43dcd 100755\n--- a/t/t1300-repo-config.sh\n+++ b/t/t1300-repo-config.sh\n@@ -460,6 +460,28 @@ EOF\n test_expect_success \"rename succeeded\" \"test_cmp expect .git/config\"\n \n cat >> .git/config << EOF\n+[branch \"vier\"] z = 1\n+EOF\n+\n+test_expect_success \"rename a section with a var on the same line\" \\\n+\t'git config --rename-section branch.vier branch.zwei'\n+\n+cat > expect << EOF\n+# Hallo\n+\t#Bello\n+[branch \"zwei\"]\n+\tx = 1\n+[branch \"zwei\"]\n+\ty = 1\n+[branch \"drei\"]\n+weird\n+[branch \"zwei\"]\n+\tz = 1\n+EOF\n+\n+test_expect_success \"rename succeeded\" \"test_cmp expect .git/config\"\n+\n+cat >> .git/config << EOF\n   [branch \"zwei\"] a = 1 [branch \"vier\"]\n EOF\n \n-- \n1.6.3.3.473.gb74fc4.dirty\n"},{"id":"118664","messageId":"20090725071105.6117@nanako3.lavabit.com","threadId":"20221","inReplyTo":"1248470504-16326-3-git-send-email-alex@chmrr.net","subject":"Re: [PATCH 2/2] After renaming a section, print any trailing variable definitions","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-07-24T22:11:05Z","receivedAt":"2009-07-24T22:11:05Z","isPatch":true,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting Alex Vandiver <alex@chmrr.net>\n\n> diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\n> index 43ea283..8c43dcd 100755\n> --- a/t/t1300-repo-config.sh\n> +++ b/t/t1300-repo-config.sh\n> @@ -460,6 +460,28 @@ EOF\n>  test_expect_success \"rename succeeded\" \"test_cmp expect .git/config\"\n>  \n>  cat >> .git/config << EOF\n> +[branch \"vier\"] z = 1\n> +EOF\n\nIsn't this a syntax error?\n\nDocumentation/config.txt says this.\n\n    Subsection names are case sensitive and can contain any characters\n    except newline (doublequote `\"` and backslash have to be escaped as\n    `\\\"` and `\\\\`, respectively).  Section headers cannot span multiple\n    lines.  Variables may belong directly to a section or to a given\n    subsection.  You can have `[section]` if you have `[section\n    \"subsection\"]`, but you don't need to.\n\n    There is also a case insensitive alternative `[section.subsection]`\n    syntax.  In this syntax, subsection names follow the same restrictions\n    as for section names.\n\n    All the other lines are recognized as setting variables, in the form\n    'name = value'.  If there is no equal sign on the line, the entire\n    line ...\n\nI read \"All the other lines\" to mean that the section headers and variable definitions are supposed to be on different lines.\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"118682","messageId":"1248474081-sup-2762@utwig","threadId":"20221","inReplyTo":"20090725071105.6117@nanako3.lavabit.com","subject":"Re: [PATCH 2/2] After renaming a section, print any trailing variable definitions","fromName":"Alex Vandiver","fromEmail":"alex@chmrr.net","sentAt":"2009-07-24T22:26:55Z","receivedAt":"2009-07-24T22:26:55Z","isPatch":true,"sender":{"key":"alex@chmrr.net","avatar":"https://avatars.githubusercontent.com/u/28347?v=4"},"body":"At Fri Jul 24 18:11:05 -0400 2009, Nanako Shiraishi wrote:\n> Quoting Alex Vandiver <alex@chmrr.net>\n> > diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\n> > index 43ea283..8c43dcd 100755\n> > --- a/t/t1300-repo-config.sh\n> > +++ b/t/t1300-repo-config.sh\n> > @@ -460,6 +460,28 @@ EOF\n> >  test_expect_success \"rename succeeded\" \"test_cmp expect .git/config\"\n> >  \n> >  cat >> .git/config << EOF\n> > +[branch \"vier\"] z = 1\n> > +EOF\n> \n> Isn't this a syntax error?\n\nNope -- at least, not according to both the code, and the tests\n(search or noNewline in t/t1300-repo-config.sh).\n\nThough I also note that the documentation disagrees with the code in\nthe following case:\n\n    Each variable must belong to some section, which means that there\n    must be a section header before the first setting of a variable.\n\n  $ cat >bogus\n  foo = 42\n\n  $ git config --file bogus --list\n  foo=42\n\n  $ git config --file bogus --get foo\n  42\n\n - Alex\n-- \nNetworking -- only one letter away from not working\n"},{"id":"118688","messageId":"7v1vo5647j.fsf@alter.siamese.dyndns.org","threadId":"20221","inReplyTo":"20090725071105.6117@nanako3.lavabit.com","subject":"Re: [PATCH 2/2] After renaming a section, print any trailing variable definitions","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-07-24T23:39:28Z","receivedAt":"2009-07-24T23:39:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nanako Shiraishi <nanako3@lavabit.com> writes:\n\n> Quoting Alex Vandiver <alex@chmrr.net>\n>\n>> diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\n>> index 43ea283..8c43dcd 100755\n>> --- a/t/t1300-repo-config.sh\n>> +++ b/t/t1300-repo-config.sh\n>> @@ -460,6 +460,28 @@ EOF\n>>  test_expect_success \"rename succeeded\" \"test_cmp expect .git/config\"\n>>  \n>>  cat >> .git/config << EOF\n>> +[branch \"vier\"] z = 1\n>> +EOF\n>\n> Isn't this a syntax error?\n>\n> Documentation/config.txt says this.\n\nEven if it were, I think it would be nice to allow it.  I'll have to\nre-read Alex's patch, but I thought it was sane.  Perhaps we can update\nthe documentation, mildly hinting that it is allowed without encouraging\nit too strongly, as I think it is a good style to have these on separate\nlines.\n\nDscho?  Have any suggestions/comments on the patch?\n"},{"id":"118694","messageId":"20090725092850.6117@nanako3.lavabit.com","threadId":"20221","inReplyTo":"7v1vo5647j.fsf@alter.siamese.dyndns.org","subject":"(unknown)","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-07-25T00:28:50Z","receivedAt":"2009-07-25T00:28:50Z","isPatch":false,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Subject: [PATCH] Documentation/config.txt: a variable can be defined on the section header line\n\nSigned-off-by: Nanako Shiraishi <nanako3@lavabit.com>\n---\n\n Quoting Junio C Hamano <gitster@pobox.com>:\n\n > Nanako Shiraishi <nanako3@lavabit.com> writes:\n >\n >> Isn't this a syntax error?\n >>\n >> Documentation/config.txt says this.\n >\n > Even if it were, I think it would be nice to allow it.  I'll have to\n > re-read Alex's patch, but I thought it was sane.  Perhaps we can update\n > the documentation, mildly hinting that it is allowed without encouraging\n > it too strongly, as I think it is a good style to have these on separate\n > lines.\n \n How about this small update to the documentation, then?\n\n Documentation/config.txt |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 6857d2f..c6f09f8 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -49,7 +49,8 @@ There is also a case insensitive alternative `[section.subsection]` syntax.\n In this syntax, subsection names follow the same restrictions as for section\n names.\n \n-All the other lines are recognized as setting variables, in the form\n+All the other lines (and the remainder of the line after the section\n+header) are recognized as setting variables, in the form\n 'name = value'.  If there is no equal sign on the line, the entire line\n is taken as 'name' and the variable is recognized as boolean \"true\".\n The variable names are case-insensitive and only alphanumeric\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"118717","messageId":"alpine.DEB.1.00.0907251605240.8306@pacific.mpi-cbg.de","threadId":"20221","inReplyTo":"1248470504-16326-2-git-send-email-alex@chmrr.net","subject":"Re: [PATCH 1/2] Make section_name_match start on '[', and return the length on success","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-07-25T14:09:56Z","receivedAt":"2009-07-25T14:09:56Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 24 Jul 2009, Alex Vandiver wrote:\n\n> diff --git a/config.c b/config.c\n> index 04380bb..7d6f6f6 100644\n> --- a/config.c\n> +++ b/config.c\n> @@ -1194,7 +1194,9 @@ write_err_out:\n>  static int section_name_match (const char *buf, const char *name)\n>  {\n>  \tint i = 0, j = 0, dot = 0;\n> -\tfor (; buf[i] && buf[i] != ']'; i++) {\n> +\tif (buf[i] != '[')\n> +\t\treturn 0;\n\nIs this not unnecessary, given that we  only call that function when we \nknow that buf[0] == '[':\n\n> @@ -1249,7 +1261,8 @@ int git_config_rename_section(const char *old_name, const char *new_name)\n>  \t\t\t; /* do nothing */\n>  \t\tif (buf[i] == '[') {\n>  \t\t\t/* it's a section */\n> -\t\t\tif (section_name_match (&buf[i+1], old_name)) {\n> +\t\t\tint offset = section_name_match (&buf[i], old_name);\n> +\t\t\tif (offset > 0) {\n>  \t\t\t\tret++;\n>  \t\t\t\tif (new_name == NULL) {\n>  \t\t\t\t\tremove = 1;\n\nI was a bit surprised that \"offset\" is not used further in your patch, but \nI saw that 2/2 uses it.\n\nSo except for the unnecessary test, I like your patches (read: ACK).\n\nCiao,\nDscho\n"},{"id":"118718","messageId":"alpine.DEB.1.00.0907251610020.8306@pacific.mpi-cbg.de","threadId":"20221","inReplyTo":"7v1vo5647j.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/2] After renaming a section, print any trailing variable definitions","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-07-25T14:10:32Z","receivedAt":"2009-07-25T14:10:32Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 24 Jul 2009, Junio C Hamano wrote:\n\n> Dscho?  Have any suggestions/comments on the patch?\n\nThanks for making me aware of the patches.  I just sent out a reply.\n\nCiao,\nDscho\n"},{"id":"118732","messageId":"1248542170-sup-4264@utwig","threadId":"20221","inReplyTo":"alpine.DEB.1.00.0907251605240.8306@pacific.mpi-cbg.de","subject":"Re: [PATCH 1/2] Make section_name_match start on '[', and return the length on success","fromName":"Alex Vandiver","fromEmail":"alex@chmrr.net","sentAt":"2009-07-25T17:18:52Z","receivedAt":"2009-07-25T17:18:52Z","isPatch":true,"sender":{"key":"alex@chmrr.net","avatar":"https://avatars.githubusercontent.com/u/28347?v=4"},"body":"At Sat Jul 25 10:09:56 -0400 2009, Johannes Schindelin wrote:\n> Is this not unnecessary, given that we  only call that function when we \n> know that buf[0] == '[':\n\nYes.  However, given that I had changed the calling convention for the\ncode, (it used to be passed the string starting just _inside_ the\n'['), I wanted to make the new calling convention clearer, and catch\nany places that were using the old convention.\n\nI'm happy to submit a new version without it, if you wish.\n\n> I was a bit surprised that \"offset\" is not used further in your patch, but \n> I saw that 2/2 uses it.\n\nYeah, this hunk should probably have gone in 2/2 instead.\n - Alex\n-- \nNetworking -- only one letter away from not working\n"},{"id":"118735","messageId":"7vbpn8u0g7.fsf@alter.siamese.dyndns.org","threadId":"20221","inReplyTo":"1248542170-sup-4264@utwig","subject":"Re: [PATCH 1/2] Make section_name_match start on '[', and return the length on success","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-07-25T17:39:04Z","receivedAt":"2009-07-25T17:39:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alex Vandiver <alex@chmrr.net> writes:\n\n> At Sat Jul 25 10:09:56 -0400 2009, Johannes Schindelin wrote:\n>> Is this not unnecessary, given that we  only call that function when we \n>> know that buf[0] == '[':\n>\n> Yes.  However, given that I had changed the calling convention for the\n> code, (it used to be passed the string starting just _inside_ the\n> '['), I wanted to make the new calling convention clearer, and catch\n> any places that were using the old convention.\n\nIt's Ok.  I do not think this is performance critical part of the system,\nand I'd feel safer with a bit of defensive programming like this,\nespecially because \"git config\" that writes (reader is Ok) has\ntraditionally been one of the most fragile part of the system.\n\n> I'm happy to submit a new version without it, if you wish.\n>\n>> I was a bit surprised that \"offset\" is not used further in your patch, but \n>> I saw that 2/2 uses it.\n>\n> Yeah, this hunk should probably have gone in 2/2 instead.\n\nI actually thought about suggesting to squash these two patches into one,\nas the change in [1/2] only makes sense in the context of the [2/2], but\ndecided against it.\n\nI haven't applied (actually, I didn't even notice until this morning) the\nsmall documentation update from Nana.  Have any comments on that one?\n"},{"id":"118736","messageId":"alpine.DEB.1.00.0907251941100.8306@pacific.mpi-cbg.de","threadId":"20221","inReplyTo":"1248542170-sup-4264@utwig","subject":"Re: [PATCH 1/2] Make section_name_match start on '[', and return the length on success","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-07-25T17:41:27Z","receivedAt":"2009-07-25T17:41:27Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 25 Jul 2009, Alex Vandiver wrote:\n\n> At Sat Jul 25 10:09:56 -0400 2009, Johannes Schindelin wrote:\n> > Is this not unnecessary, given that we  only call that function when we \n> > know that buf[0] == '[':\n> \n> Yes.  However, given that I had changed the calling convention for the\n> code, (it used to be passed the string starting just _inside_ the\n> '['), I wanted to make the new calling convention clearer, and catch\n> any places that were using the old convention.\n> \n> I'm happy to submit a new version without it, if you wish.\n> \n> > I was a bit surprised that \"offset\" is not used further in your patch, but \n> > I saw that 2/2 uses it.\n> \n> Yeah, this hunk should probably have gone in 2/2 instead.\n\nNo need to change anything, Junio already applied your patches.\n\nCiao,\nDscho\n"},{"id":"118835","messageId":"1248625102-472-1-git-send-email-alex@chmrr.net","threadId":"20221","inReplyTo":"1248474081-sup-2762@utwig","subject":"[PATCH] Make git config fail on variables with no section, as documented","fromName":"Alex Vandiver","fromEmail":"alex@chmrr.net","sentAt":"2009-07-26T16:18:22Z","receivedAt":"2009-07-26T16:18:22Z","isPatch":true,"sender":{"key":"alex@chmrr.net","avatar":"https://avatars.githubusercontent.com/u/28347?v=4"},"body":"Documentation/config.txt claims:\n\n    Each variable must belong to some section, which means that there\n    must be a section header before the first setting of a variable.\n\nHowever, the parsing code did not enforce this.  This change makes it\na syntax error to defined a variable before the first section header.\n\nSigned-off-by: Alex Vandiver <alex@chmrr.net>\n---\n config.c |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/config.c b/config.c\nindex 1b3823d..447ad00 100644\n--- a/config.c\n+++ b/config.c\n@@ -248,6 +248,8 @@ static int git_parse_file(config_fn_t fn, void *data)\n \t\t}\n \t\tif (!isalpha(c))\n \t\t\tbreak;\n+\t\tif (baselen == 0)\n+\t\t\tbreak;\n \t\tvar[baselen] = tolower(c);\n \t\tif (get_value(fn, data, var, baselen+1) < 0)\n \t\t\tbreak;\n-- \n1.6.3.3.473.gb74fc4.dirty\n"},{"id":"118839","messageId":"alpine.DEB.1.00.0907261849110.8306@pacific.mpi-cbg.de","threadId":"20221","inReplyTo":"1248625102-472-1-git-send-email-alex@chmrr.net","subject":"Re: [PATCH] Make git config fail on variables with no section, as documented","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-07-26T16:49:28Z","receivedAt":"2009-07-26T16:49:28Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 26 Jul 2009, Alex Vandiver wrote:\n\n> Documentation/config.txt claims:\n> \n>     Each variable must belong to some section, which means that there\n>     must be a section header before the first setting of a variable.\n> \n> However, the parsing code did not enforce this.  This change makes it\n> a syntax error to defined a variable before the first section header.\n\nIs there any downside in allowing this?\n\nCiao,\nDscho\n"},{"id":"118845","messageId":"1248636518-sup-7499@utwig","threadId":"20221","inReplyTo":"alpine.DEB.1.00.0907261849110.8306@pacific.mpi-cbg.de","subject":"Re: [PATCH] Make git config fail on variables with no section, as documented","fromName":"Alex Vandiver","fromEmail":"alex@chmrr.net","sentAt":"2009-07-26T19:32:45Z","receivedAt":"2009-07-26T19:32:45Z","isPatch":true,"sender":{"key":"alex@chmrr.net","avatar":"https://avatars.githubusercontent.com/u/28347?v=4"},"body":"At Sun Jul 26 12:49:28 -0400 2009, Johannes Schindelin wrote:\n> Is there any downside in allowing this?\n\nNot explicitly.  However, there are no legal current uses of it, and\nallowing it might encourage extensions to use the top-level config\nnamespace.  It also has the odd property that it _must_ be at the top\nof a configuration file -- unlike all other configuration options, you\ncan never return to the section to add more variable definitions\nlater.\n - Alex\n-- \nNetworking -- only one letter away from not working\n"},{"id":"118846","messageId":"alpine.DEB.1.00.0907262146530.8306@pacific.mpi-cbg.de","threadId":"20221","inReplyTo":"1248636518-sup-7499@utwig","subject":"Re: [PATCH] Make git config fail on variables with no section, as documented","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-07-26T19:48:20Z","receivedAt":"2009-07-26T19:48:20Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 26 Jul 2009, Alex Vandiver wrote:\n\n> At Sun Jul 26 12:49:28 -0400 2009, Johannes Schindelin wrote:\n> > Is there any downside in allowing this?\n> \n> Not explicitly.  However, there are no legal current uses of it, and\n> allowing it might encourage extensions to use the top-level config\n> namespace.\n\nSo?\n\n> It also has the odd property that it _must_ be at the top of a \n> configuration file -- unlike all other configuration options, you can \n> never return to the section to add more variable definitions later.\n\nYes, that is a special property that you might actually want in some \ncontexts.\n\nThat, together with the fact that \"git config -f <file>\" was meant \n_explicitely_ to allow 3rd party porcelains having their own config files \nwithout having to implement their own \"git config\" lets me suspect that \nwe'd rather want the current behavior.\n\nCiao,\nDscho\n"},{"id":"118847","messageId":"1248637797-sup-6595@utwig","threadId":"20221","inReplyTo":"alpine.DEB.1.00.0907262146530.8306@pacific.mpi-cbg.de","subject":"Re: [PATCH] Make git config fail on variables with no section, as documented","fromName":"Alex Vandiver","fromEmail":"alex@chmrr.net","sentAt":"2009-07-26T20:24:37Z","receivedAt":"2009-07-26T20:24:37Z","isPatch":true,"sender":{"key":"alex@chmrr.net","avatar":"https://avatars.githubusercontent.com/u/28347?v=4"},"body":"At Sun Jul 26 15:48:20 -0400 2009, Johannes Schindelin wrote:\n> That, together with the fact that \"git config -f <file>\" was meant \n> _explicitely_ to allow 3rd party porcelains having their own config files \n> without having to implement their own \"git config\" lets me suspect that \n> we'd rather want the current behavior.\n\n*shrug* Note I'm not wholly convinced of the rationale myself -- I'm\nmerely trying to reconcile the documentation and reality.  I'll also\nnote that you can't, at current, set or unset such values from the\ncommand-line.\n\nLooking back at the blame for the documentation, it looks like e136f33\nin 2007 is what added the claim that section-less variables weren't\nacceptable.  The `git repo-config` of the time parsed them just fine,\nhowever.\n\nIf you wish to correct the documentation instead, I can send in a doc\npatch.  Fixing --set and --unset to work with section-less variables\nwill take a bit more work, however.\n - Alex\n-- \nNetworking -- only one letter away from not working\n"}]}