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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Junio C Hamano <gitster@xxxxxxxxx>

So that --get and --get-colorbool are diagnosed as errors.

Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux