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

Re: [PATCH] add--interactive: respect diff.algorithm

From
Jeff King <peff@peff.net>
Date
Jun 12, 2013, 19:18 UTC
Message-ID
<20130612191817.GA4898@sigill.intra.peff.net>
In-Reply-To
<20130612184410.GB23890@serenity.lan>
On Wed, Jun 12, 2013 at 07:44:10PM +0100, John Keeping wrote:
Show 12 quoted lines
> When staging hunks interactively it is sometimes useful to use an
> alternative diff algorithm which splits the changes into hunks in a more
> logical manner.  This is not possible because the plumbing commands
> called by add--interactive ignore the "diff.algorithm" configuration
> option (as they should).
> 
> Since add--interactive is a porcelain command it should respect this
> configuration variable.  To do this, make it read diff.algorithm and
> pass its value to the underlying diff-index and diff-files invocations.
> 
> At this point, do not add options to "git add", "git reset" or "git
> checkout" (all of which can call git-add--interactive).  If a user want
s/want/wants/
Show 7 quoted lines
> >   if (defined $diff_algorithm) {
> >           push @diff_cmd, "--diff-algorithm=$diff_algorithm";
> >   }
> 
> OK.  The "default" is actually "the value that is equivalent to 'myers'
> for diff.algorithm" and I was originally going to add --diff-algorithm
> to the command line unconditionally.

Yeah, that might have made sense, too, but the in-between (we know that "default" is a special token and don't pass it) does not to me.

Patch looks obviously correct to me. Thanks.
-Peff
Previous: John KeepingNext: Junio C Hamano
Message 7 of 10 in “Different diff strategies in add --interactive”
  1. John KeepingJun 10, 2013
  2. Junio C HamanoJun 10, 2013
  3. Jeff KingJun 10, 2013
  4. John KeepingJun 10, 2013
  5. Jeff KingJun 10, 2013
  6. add--interactive: respect diff.algorithmJohn Keeping, Jun 12, 2013
  7. Jeff KingJun 12, 2013
  8. Junio C HamanoJun 23, 2013
  9. John KeepingJun 23, 2013
  10. Junio C HamanoJun 23, 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.