{"thread":{"id":"10211","subject":"[PATCH] git-config: respect other options after -l, most notably --file","startedAt":"2007-10-09T12:50:24Z","lastAt":"2007-10-12T11:37:41Z","messageCount":4,"participants":["Gerrit Pape","Johannes Schindelin","Frank Lichtenheld"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"55266","messageId":"20071009125024.1259.qmail@d8e601127fe8d0.315fe32.mid.smarden.org","threadId":"10211","inReplyTo":null,"subject":"[PATCH] git-config: respect other options after -l, most notably --file","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2007-10-09T12:50:24Z","receivedAt":"2007-10-09T12:50:24Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"When git-commit is seeing the -l|--list option, it stops reading the\nfollowing command line options.  So although they should be the same,\nthe following commands act differently:\n\n git config --file ../repo2/.git/config -l\n git config -l --file ../repo2/.git/config\n\nThis patch delays the 'list all variables' to after the command line\noptions have been processed.\n\nThe problem was noticed by Joey Hess, reported through\n http://bugs.debian.org/445208\n\nSigned-off-by: Gerrit Pape <pape@smarden.org>\n---\n builtin-config.c |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-config.c b/builtin-config.c\nindex c2708ba..1bb0ebb 100644\n--- a/builtin-config.c\n+++ b/builtin-config.c\n@@ -8,6 +8,7 @@ static char *key;\n static regex_t *key_regexp;\n static regex_t *regexp;\n static int show_keys;\n+static int show_all;\n static int use_key_regexp;\n static int do_all;\n static int do_not_match;\n@@ -173,7 +174,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n \t\telse if (!strcmp(argv[1], \"--bool\"))\n \t\t\ttype = T_BOOL;\n \t\telse if (!strcmp(argv[1], \"--list\") || !strcmp(argv[1], \"-l\"))\n-\t\t\treturn git_config(show_all_config);\n+\t\t\tshow_all = 1;\n \t\telse if (!strcmp(argv[1], \"--global\")) {\n \t\t\tchar *home = getenv(\"HOME\");\n \t\t\tif (home) {\n@@ -234,6 +235,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n \t\targv++;\n \t}\n \n+\tif (show_all)\n+\t\treturn git_config(show_all_config);\n \tswitch (argc) {\n \tcase 2:\n \t\treturn get_value(argv[1], NULL);\n-- \n1.5.3.4\n"},{"id":"55277","messageId":"Pine.LNX.4.64.0710091414590.4174@racer.site","threadId":"10211","inReplyTo":"20071009125024.1259.qmail@d8e601127fe8d0.315fe32.mid.smarden.org","subject":"Re: [PATCH] git-config: respect other options after -l, most notably --file","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-09T13:15:51Z","receivedAt":"2007-10-09T13:15:51Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 9 Oct 2007, Gerrit Pape wrote:\n\n> @@ -234,6 +235,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n>  \t\targv++;\n>  \t}\n>  \n> +\tif (show_all)\n> +\t\treturn git_config(show_all_config);\n>  \tswitch (argc) {\n>  \tcase 2:\n>  \t\treturn get_value(argv[1], NULL);\n\nShouldn't this somehow check if argc == 1 when show_all is set, and die \notherwise?\n\nCiao,\nDscho\n"},{"id":"55324","messageId":"20071009224943.GH31659@planck.djpig.de","threadId":"10211","inReplyTo":"20071009125024.1259.qmail@d8e601127fe8d0.315fe32.mid.smarden.org","subject":"Re: [PATCH] git-config: respect other options after -l, most notably --file","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-10-09T22:49:43Z","receivedAt":"2007-10-09T22:49:43Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"On Tue, Oct 09, 2007 at 12:50:24PM +0000, Gerrit Pape wrote:\n> When git-commit is seeing the -l|--list option, it stops reading the\n> following command line options.  So although they should be the same,\n> the following commands act differently:\n> \n>  git config --file ../repo2/.git/config -l\n>  git config -l --file ../repo2/.git/config\n> \n> This patch delays the 'list all variables' to after the command line\n> options have been processed.\n\nNote that I have posted a conflicting patch for the same problem some\ndays ago. I think my patch is more consistent with the behaviour for\nother options.\n\nGruesse,\n-- \nFrank Lichtenheld <frank@lichtenheld.de>\nwww: http://www.djpig.de/\n"},{"id":"55547","messageId":"20071012113741.30469.qmail@a4342ff4e2e64a.315fe32.mid.smarden.org","threadId":"10211","inReplyTo":"20071009224943.GH31659@planck.djpig.de","subject":"[PATCH drop] git-config: respect other options after -l, most notably --file","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2007-10-12T11:37:41Z","receivedAt":"2007-10-12T11:37:41Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"On Wed, Oct 10, 2007 at 12:49:43AM +0200, Frank Lichtenheld wrote:\n> On Tue, Oct 09, 2007 at 12:50:24PM +0000, Gerrit Pape wrote:\n> > When git-commit is seeing the -l|--list option, it stops reading the\n> > following command line options.  So although they should be the same,\n> > the following commands act differently:\n> > \n> >  git config --file ../repo2/.git/config -l\n> >  git config -l --file ../repo2/.git/config\n> > \n> > This patch delays the 'list all variables' to after the command line\n> > options have been processed.\n> \n> Note that I have posted a conflicting patch for the same problem some\n> days ago. I think my patch is more consistent with the behaviour for\n> other options.\n\nFair enough.  Regards, Gerrit.\n"}]}