Thread (11 messages) flat view 11 messages, 2 authors, 2016-06-15

Re: [PATCH v2 2/8] config: Reorganize get_color*.

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:46:13

On Tue, Feb 17, 2009 at 2:54 AM, Felipe Contreras
[off-list ref] wrote:
In preparation for parseopt.

Signed-off-by: Felipe Contreras <redacted>
---
<snip/>
quoted hunk ↗ jump to hunk
@@ -274,12 +237,11 @@ static int get_colorbool(int argc, const char **argv)
                       get_colorbool_found = git_use_color_default;
       }

-       if (argc == 1) {
-               return get_colorbool_found ? 0 : 1;
-       } else {
+       if (print) {
               printf("%s\n", get_colorbool_found ? "true" : "false");
               return 0;
-       }
+       } else
+               return get_colorbool_found ? 0 : 1;
 }
<snip/>
               } else if (!strcmp(argv[1], "--get-colorbool")) {
-                       return get_colorbool(argc-2, argv+2);
+                       if (argc == 4)
+                               stdout_is_tty = git_config_bool("command line", argv[3]);
+                       else if (argc == 3)
+                               stdout_is_tty = isatty(1);
+                       else
+                               usage(git_config_set_usage);
+                       get_colorbool_slot = argv[2];
+                       return get_colorbool(argc == 3);
Agh, crap, that should be argc != 3. Anyway, the next patch does it properly.

-- 
Felipe Contreras
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help