Re: [PATCH v2] parse-opt: migrate builtin-apply.

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

 



Miklos Vajna schrieb:
> -static const char apply_usage[] =
> -"git apply [--stat] [--numstat] [--summary] [--check] [--index] [--cached] [--apply] [--no-add] [--index-info] [--allow-binary-replacement] [--reverse] [--reject] [--verbose] [-z] [-pNUM] [-CNUM] [--whitespace=<nowarn|warn|fix|error|error-all>] <patch>...";
> +static const char * const apply_usage[] = {
> +	"git apply [--stat] [--numstat] [--summary] [--check] [--index] [--cached] [--apply] [--no-add] [--index-info] [--allow-binary-replacement] [--reverse] [--reject] [--verbose] [-z] [-pNUM] [-CNUM] [--whitespace=<nowarn|warn|fix|error|error-all>] <patch>...",
> +	NULL
> +};

A useful convention with parse_options is to display "[options]" as a
place holder instead of listing all options explicitly in the usage
string.  They are listed and explained in the full help message anyway
shown by "git apply -?").

> +static int option_parse_inaccurate(const struct option *opt,
> +				   const char *arg, int unset)
> +{
> +	options |= INACCURATE_EOF;
> +	return 0;
> +}
> +
> +static int option_parse_recount(const struct option *opt,
> +				const char *arg, int unset)
> +{
> +	options |= RECOUNT;
> +	return 0;
> +}

OPT_BIT?

> +		OPT_INTEGER('C', NULL, &p_context,
> +				"ensure at least <n> lines of context match"),

p_context is an unsigned long variable; OPT_INTEGER expects a pointer
to an int.  You'd either need an OPT_ULONG macro or change p_context
to in int.  Doing the latter fixed the two test cases t4105 and t4252
for me.

René
--
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