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

[PATCH] add--interactive: respect diff.compactionHeuristic

From
Jeff King <peff@peff.net>
Date
Jun 16, 2016, 12:27 UTC
Message-ID
<20160616122729.GC15988@sigill.intra.peff.net>
In-Reply-To
<CAEtHF9Ne7a25cOF_6L=ZXRnmR4NbnUBDFR+6V-PryjtK8yNO8g@mail.gmail.com>
On Wed, Jun 15, 2016 at 08:24:47AM +0200, Alex Prengère wrote:
> I see, it makes sense ;-) Indeed it would seem logical to have all
> commands showing diffs (diff, add -p, log -p, reset -p, etc..) respect
> the diff options.
Here's a patch to do so, similar to what we do for diff.algorithm.
-- >8 --
Subject: add--interactive: respect diff.compactionHeuristic

We use plumbing to generate the diff, so it doesn't automatically pick up UI config like compactionHeuristic. Let's forward it on, since interactive adding is porcelain.

Note that we only need to handle the "true" case. There's no point in passing --no-compaction-heuristic when the variable is false, since nothing else could have turned it on.

Signed-off-by: Jeff King <peff@peff.net>
---
 git-add--interactive.perl | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 822f857..642cce1 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -45,6 +45,7 @@ my ($diff_new_color) =
 my $normal_color = $repo->get_color("", "reset");
 
 my $diff_algorithm = $repo->config('diff.algorithm');
+my $diff_compaction_heuristic = $repo->config_bool('diff.compactionheuristic');
 my $diff_filter = $repo->config('interactive.difffilter');
 
 my $use_readkey = 0;
@@ -749,6 +750,9 @@ sub parse_diff {
 	if (defined $diff_algorithm) {
 		splice @diff_cmd, 1, 0, "--diff-algorithm=${diff_algorithm}";
 	}
+	if ($diff_compaction_heuristic) {
+		splice @diff_cmd, 1, 0, "--compaction-heuristic";
+	}
 	if (defined $patch_mode_revision) {
 		push @diff_cmd, get_diff_reference($patch_mode_revision);
 	}
-- 
2.9.0.160.g4984cba
Previous: Alex PrengèreNext: Stefan Beller
Message 5 of 7 in “compactionHeuristic=true is not used by interactive staging”
  1. Alex PrengèreJun 14, 2016
  2. Jeff KingJun 14, 2016
  3. Junio C HamanoJun 14, 2016
  4. Alex PrengèreJun 15, 2016
  5. add--interactive: respect diff.compactionHeuristicJeff King, Jun 16, 2016
  6. Stefan BellerJun 16, 2016
  7. Jeff KingJun 16, 2016

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.