* [PATCH] git-config: respect other options after -l, most notably --file
@ 2007-10-09 12:50 Gerrit Pape
2007-10-09 13:15 ` Johannes Schindelin
2007-10-09 22:49 ` Frank Lichtenheld
0 siblings, 2 replies; 4+ messages in thread
From: Gerrit Pape @ 2007-10-09 12:50 UTC (permalink / raw)
To: Junio C Hamano, git
When git-commit is seeing the -l|--list option, it stops reading the
following command line options. So although they should be the same,
the following commands act differently:
git config --file ../repo2/.git/config -l
git config -l --file ../repo2/.git/config
This patch delays the 'list all variables' to after the command line
options have been processed.
The problem was noticed by Joey Hess, reported through
http://bugs.debian.org/445208
Signed-off-by: Gerrit Pape <pape@smarden.org>
---
builtin-config.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/builtin-config.c b/builtin-config.c
index c2708ba..1bb0ebb 100644
--- a/builtin-config.c
+++ b/builtin-config.c
@@ -8,6 +8,7 @@ static char *key;
static regex_t *key_regexp;
static regex_t *regexp;
static int show_keys;
+static int show_all;
static int use_key_regexp;
static int do_all;
static int do_not_match;
@@ -173,7 +174,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
else if (!strcmp(argv[1], "--bool"))
type = T_BOOL;
else if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-l"))
- return git_config(show_all_config);
+ show_all = 1;
else if (!strcmp(argv[1], "--global")) {
char *home = getenv("HOME");
if (home) {
@@ -234,6 +235,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)
argv++;
}
+ if (show_all)
+ return git_config(show_all_config);
switch (argc) {
case 2:
return get_value(argv[1], NULL);
--
1.5.3.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] git-config: respect other options after -l, most notably --file
2007-10-09 12:50 [PATCH] git-config: respect other options after -l, most notably --file Gerrit Pape
@ 2007-10-09 13:15 ` Johannes Schindelin
2007-10-09 22:49 ` Frank Lichtenheld
1 sibling, 0 replies; 4+ messages in thread
From: Johannes Schindelin @ 2007-10-09 13:15 UTC (permalink / raw)
To: Gerrit Pape; +Cc: Junio C Hamano, git
Hi,
On Tue, 9 Oct 2007, Gerrit Pape wrote:
> @@ -234,6 +235,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)
> argv++;
> }
>
> + if (show_all)
> + return git_config(show_all_config);
> switch (argc) {
> case 2:
> return get_value(argv[1], NULL);
Shouldn't this somehow check if argc == 1 when show_all is set, and die
otherwise?
Ciao,
Dscho
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] git-config: respect other options after -l, most notably --file
2007-10-09 12:50 [PATCH] git-config: respect other options after -l, most notably --file Gerrit Pape
2007-10-09 13:15 ` Johannes Schindelin
@ 2007-10-09 22:49 ` Frank Lichtenheld
2007-10-12 11:37 ` [PATCH drop] " Gerrit Pape
1 sibling, 1 reply; 4+ messages in thread
From: Frank Lichtenheld @ 2007-10-09 22:49 UTC (permalink / raw)
To: Gerrit Pape; +Cc: Junio C Hamano, git
On Tue, Oct 09, 2007 at 12:50:24PM +0000, Gerrit Pape wrote:
> When git-commit is seeing the -l|--list option, it stops reading the
> following command line options. So although they should be the same,
> the following commands act differently:
>
> git config --file ../repo2/.git/config -l
> git config -l --file ../repo2/.git/config
>
> This patch delays the 'list all variables' to after the command line
> options have been processed.
Note that I have posted a conflicting patch for the same problem some
days ago. I think my patch is more consistent with the behaviour for
other options.
Gruesse,
--
Frank Lichtenheld <frank@lichtenheld.de>
www: http://www.djpig.de/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH drop] git-config: respect other options after -l, most notably --file
2007-10-09 22:49 ` Frank Lichtenheld
@ 2007-10-12 11:37 ` Gerrit Pape
0 siblings, 0 replies; 4+ messages in thread
From: Gerrit Pape @ 2007-10-12 11:37 UTC (permalink / raw)
To: Frank Lichtenheld; +Cc: Junio C Hamano, git
On Wed, Oct 10, 2007 at 12:49:43AM +0200, Frank Lichtenheld wrote:
> On Tue, Oct 09, 2007 at 12:50:24PM +0000, Gerrit Pape wrote:
> > When git-commit is seeing the -l|--list option, it stops reading the
> > following command line options. So although they should be the same,
> > the following commands act differently:
> >
> > git config --file ../repo2/.git/config -l
> > git config -l --file ../repo2/.git/config
> >
> > This patch delays the 'list all variables' to after the command line
> > options have been processed.
>
> Note that I have posted a conflicting patch for the same problem some
> days ago. I think my patch is more consistent with the behaviour for
> other options.
Fair enough. Regards, Gerrit.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-10-12 11:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-09 12:50 [PATCH] git-config: respect other options after -l, most notably --file Gerrit Pape
2007-10-09 13:15 ` Johannes Schindelin
2007-10-09 22:49 ` Frank Lichtenheld
2007-10-12 11:37 ` [PATCH drop] " Gerrit Pape
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).