git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: Miklos Vajna <vmiklos@frugalware.org>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH v2] parse-opt: migrate builtin-apply.
Date: Sat, 27 Dec 2008 22:53:43 +0100	[thread overview]
Message-ID: <4956A3E7.7070208@lsrfire.ath.cx> (raw)
In-Reply-To: <1230387764-11230-1-git-send-email-vmiklos@frugalware.org>

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é

  parent reply	other threads:[~2008-12-27 21:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-27  4:22 [PATCH] parse-opt: migrate builtin-apply Miklos Vajna
2008-12-27  7:29 ` Junio C Hamano
2008-12-27 14:05   ` Miklos Vajna
2008-12-27 14:22     ` [PATCH v2] " Miklos Vajna
2008-12-27 21:47       ` Junio C Hamano
2009-01-05 19:12         ` Pierre Habouzit
2009-01-05 20:06           ` Miklos Vajna
2008-12-27 21:53       ` René Scharfe [this message]
2008-12-27 23:03         ` [PATCH] " Miklos Vajna
2008-12-28  0:05           ` Jacob Helwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4956A3E7.7070208@lsrfire.ath.cx \
    --to=rene.scharfe@lsrfire.ath.cx \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=vmiklos@frugalware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).