Re: [PATCH v2 4/5] checkout: cleanup --conflict=<style> parsing

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

 



"Phillip Wood via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

> +static int parse_opt_conflict(const struct option *o, const char *arg, int unset)
> +{
> +	struct checkout_opts *opts = o->value;
> +
> +	if (unset) {
> +		opts->conflict_style = -1;
> +		return 0;
> +	}
> +	opts->conflict_style = parse_conflict_style_name(arg);
> +	if (opts->conflict_style < 0)
> +		return error(_("unknown conflict style '%s'"), arg);
> +
> +	return 0;
> +}
> +
>  static struct option *add_common_options(struct checkout_opts *opts,
>  					 struct option *prevopts)
>  {
> @@ -1628,8 +1649,9 @@ static struct option *add_common_options(struct checkout_opts *opts,
>  			    PARSE_OPT_OPTARG, option_parse_recurse_submodules_worktree_updater),
>  		OPT_BOOL(0, "progress", &opts->show_progress, N_("force progress reporting")),
>  		OPT_BOOL('m', "merge", &opts->merge, N_("perform a 3-way merge with the new branch")),
> -		OPT_STRING(0, "conflict", &opts->conflict_style, N_("style"),
> -			   N_("conflict style (merge, diff3, or zdiff3)")),
> +		OPT_CALLBACK(0, "conflict", opts, N_("style"),
> +			     N_("conflict style (merge, diff3, or zdiff3)"),
> +			     parse_opt_conflict),
>  		OPT_END()
>  	};
>  	struct option *newopts = parse_options_concat(prevopts, options);

Looking good.




[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