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

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

 



On Tue, Feb 17, 2009 at 2:54 AM, Felipe Contreras
<felipe.contreras@xxxxxxxxx> wrote:
> In preparation for parseopt.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
> ---

<snip/>

> @@ -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
--
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