threads / patch / 10162

patchgit-config: don't silently ignore options after --list

Subject: [PATCH] git-config: don't silently ignore options after --list

## tl;dr

One message between Oct 5, 2007 and Oct 5, 2007. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Frank Lichtenheld· Oct 5, 2007, 20:16 UTC · lore

Error out if someone gives options after --list since that is not a valid syntax.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
---
 builtin-config.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
 Two minutes of my life I don't get back ;)
Show changes to builtin-config.c +4 −1
diff --git a/builtin-config.c b/builtin-config.c
index 0a605e0..cb7e9e9 100644
--- a/builtin-config.c
+++ b/builtin-config.c
@@ -172,8 +172,11 @@ int cmd_config(int argc, const char **argv, const char *prefix)
 			type = T_INT;
 		else if (!strcmp(argv[1], "--bool"))
 			type = T_BOOL;
-		else if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-l"))
+		else if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-l")) {
+			if (argc != 2)
+				usage(git_config_set_usage);
 			return git_config(show_all_config);
+		}
 		else if (!strcmp(argv[1], "--global")) {
 			char *home = getenv("HOME");
 			if (home) {
-- 
1.5.3.4

← back to recent threads