git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 07/10] config: Disallow --getcolor* and other actions.

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Feb 17, 2009, 13:52 UTC
Message-ID
<1234878776-13250-7-git-send-email-felipe.contreras@gmail.com>
In-Reply-To
<1234878776-13250-6-git-send-email-felipe.contreras@gmail.com>
From: Junio C Hamano <gitster@pobox.com>
So that --get and --get-colorbool are diagnosed as errors.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 builtin-config.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/builtin-config.c b/builtin-config.c
index 45b4a9f..8ee0cd9 100644
--- a/builtin-config.c
+++ b/builtin-config.c
@@ -40,6 +40,8 @@ static int end_null;
 #define ACTION_EDIT (1<<10)
 #define ACTION_SET (1<<11)
 #define ACTION_SET_ALL (1<<12)
+#define ACTION_GET_COLOR (1<<13)
+#define ACTION_GET_COLORBOOL (1<<14)
 
 static struct option builtin_config_options[] = {
 	OPT_GROUP("Config file location"),
@@ -339,6 +341,11 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)
 		key_delim = '\n';
 	}
 
+	if (get_color_slot)
+	    actions |= ACTION_GET_COLOR;
+	if (get_colorbool_slot)
+	    actions |= ACTION_GET_COLORBOOL;
+
 	if (HAS_MULTI_BITS(actions)) {
 		error("only one action at a time.");
 		usage_with_options(builtin_config_usage, builtin_config_options);
@@ -432,10 +439,10 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)
 		if (ret == 0)
 			die("No such section!");
 	}
-	else if (get_color_slot) {
+	else if (actions == ACTION_GET_COLOR) {
 		get_color(argv[0]);
 	}
-	else if (get_colorbool_slot) {
+	else if (actions == ACTION_GET_COLORBOOL) {
 		if (argc == 1)
 			stdout_is_tty = git_config_bool("command line", argv[0]);
 		else if (argc == 0)
-- 
1.6.1.3
Previous: Felipe ContrerasNext: Felipe Contreras
Message 7 of 16 in “config: Codestyle cleanups.”
  1. 01/10 config: Codestyle cleanups.Felipe Contreras, Feb 17, 2009
  2. 02/10 config: Cleanup editor action.Felipe Contreras, Feb 17, 2009
  3. 03/10 config: Make git_config() more flexible.Felipe Contreras, Feb 17, 2009
  4. 04/10 config: Trivial rename in preparation for parseopt.Felipe Contreras, Feb 17, 2009
  5. 05/10 config: Reorganize get_color*.Felipe Contreras, Feb 17, 2009
  6. 06/10 config: Use parseopt.Felipe Contreras, Feb 17, 2009
  7. 07/10 config: Disallow --getcolor* and other actions.Felipe Contreras, Feb 17, 2009
  8. 08/10 config: Disallow multiple config file locations.Felipe Contreras, Feb 17, 2009
  9. 09/10 config: Disallow multiple variable types.Felipe Contreras, Feb 17, 2009
  10. 10/10 config: Don't allow extra arguments for -e or -l.Felipe Contreras, Feb 17, 2009
  11. Junio C HamanoFeb 18, 2009
  12. Felipe ContrerasFeb 18, 2009
  13. Junio C HamanoFeb 18, 2009
  14. Sverre RabbelierFeb 17, 2009
  15. Felipe ContrerasFeb 18, 2009
  16. Junio C HamanoFeb 18, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.