git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] diff: allow unstuck arguments with --diff-algorithm

From
Thomas Rast <trast@inf.ethz.ch>
Date
Apr 5, 2013, 11:43 UTC
Message-ID
<876201td7v.fsf@linux-k42r.v.cablecom.net>
In-Reply-To
<8fc6f21da7c876d50f2f35c73252e95d525dffb5.1365160527.git.john@keeping.me.uk>
John Keeping <john@keeping.me.uk> writes:
Show 5 quoted lines
> The argument to --diff-algorithm is mandatory, so there is no reason to
> require the argument to be stuck to the option with '='.  Change this
> for consistency with other Git commands.
>
> Note that this doesi not change the handling of diff-algorithm in
                     ^
strayi ;-)
Show 31 quoted lines
> merge-recursive.c since the primary interface to that is via the -X
> option to 'git merge' where the unstuck form does not make sense.
>
> Signed-off-by: John Keeping <john@keeping.me.uk>
> ---
>  diff.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/diff.c b/diff.c
> index db952a5..e0152f8 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -3596,8 +3596,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
>  		options->xdl_opts = DIFF_WITH_ALG(options, PATIENCE_DIFF);
>  	else if (!strcmp(arg, "--histogram"))
>  		options->xdl_opts = DIFF_WITH_ALG(options, HISTOGRAM_DIFF);
> -	else if (!prefixcmp(arg, "--diff-algorithm=")) {
> -		long value = parse_algorithm_value(arg+17);
> +	else if ((argcount = parse_long_opt("diff-algorithm", av, &optarg))) {
> +		long value = parse_algorithm_value(optarg);
>  		if (value < 0)
>  			return error("option diff-algorithm accepts \"myers\", "
>  				     "\"minimal\", \"patience\" and \"histogram\"");
> @@ -3605,6 +3605,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
>  		DIFF_XDL_CLR(options, NEED_MINIMAL);
>  		options->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
>  		options->xdl_opts |= value;
> +		return argcount;
>  	}
>  
>  	/* flags options */
-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: John KeepingNext: John Keeping
Message 2 of 3 in “diff: allow unstuck arguments with --diff-algorithm”
  1. diff: allow unstuck arguments with --diff-algorithmJohn Keeping, Apr 5, 2013
  2. Thomas RastApr 5, 2013
  3. diff: allow unstuck arguments with --diff-algorithmJohn Keeping, Apr 5, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.