threads / discuss / 35005

Unknown option for merge-recursive: -Xdiff-algorithm=minimal

Subject: Unknown option for merge-recursive: -Xdiff-algorithm=minimal

## tl;dr

2 messages between Sep 24, 2013 and Sep 24, 2013.

replies: 1people: 2as markdown or json

Luke Noel-Storr· Sep 24, 2013, 09:00 UTC · lore
Hi,
I'm trying to use the diff-algorithm option for recursive merge, but get the above error.  I've tried various different ways of specifying the option, but none work.
To try and find what the correct syntax is I tried peeping into the source code, and it looks like it may actually be an error in the code.
This is from merge-recursive.c line 2072:
	else if (!strcmp(s, "diff-algorithm=")) {
		long value = parse_algorithm_value(s+15);
		if (value < 0)
			return -1;
		/* clear out previous settings */
		DIFF_XDL_CLR(o, NEED_MINIMAL);
		o->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
		o->xdl_opts |= value;
	}
I believe !strcmp(s, "diff-algorithm=") should actually be !prefixcmp(s, "diff-algorithm=")
Could someone confirm this is a bug, and is there any other way I can specify the diff algorithm?
Many Thanks,
Luke Noel-Storr.
John Keeping· Sep 24, 2013, 10:01 UTC · re: Luke Noel-Storr · lore

Re: Unknown option for merge-recursive: -Xdiff-algorithm=minimal

On Tue, Sep 24, 2013 at 10:00:30AM +0100, Luke Noel-Storr wrote:
Show 23 quoted lines
> I'm trying to use the diff-algorithm option for recursive merge, but
> get the above error.  I've tried various different ways of specifying
> the option, but none work.
> 
> To try and find what the correct syntax is I tried peeping into the
> source code, and it looks like it may actually be an error in the
> code.
> 
> This is from merge-recursive.c line 2072:
> 
> 	else if (!strcmp(s, "diff-algorithm=")) {
> 		long value = parse_algorithm_value(s+15);
> 		if (value < 0)
> 			return -1;
> 		/* clear out previous settings */
> 		DIFF_XDL_CLR(o, NEED_MINIMAL);
> 		o->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
> 		o->xdl_opts |= value;
> 	}
> 
> I believe !strcmp(s, "diff-algorithm=") should actually be !prefixcmp(s, "diff-algorithm=")
> 
> Could someone confirm this is a bug, and is there any other way I can specify the diff algorithm?
I think you're right - this should be prefixcmp.

The simplest thing to do would be to patch it locally and run your own build - Git's Makefile installs in your home directory by default, so providing $HOME/bin is on your path, "make install" will just give you something that works.

Of course, you should then submit the patch here ;-)

← back to recent threads