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

Re: What's in git.git (stable frozen)

From
Jeff King <peff@peff.net>
Date
Jan 6, 2008, 04:29 UTC
Message-ID
<20080106042935.GB4843@coredump.intra.peff.net>
In-Reply-To
<20080106042409.GA4843@coredump.intra.peff.net>
On Sat, Jan 05, 2008 at 11:24:09PM -0500, Jeff King wrote:
Show 8 quoted lines
> >  * Jeff's git-add--interactive change to always honor color.diff
> >    regardless of color.interactive.
> > 
> >    I'd probably apply this, along with the patch to redefine
> >    what color.interactive means.  "git am -i" could also learn
> >    to use colors in the future.
> 
> Here is the palette cleanup patch, on top of my others (it should still

And while tracking down the $fraginfo usage, I noticed that my original patches introduce a bug. Fix is below (it is on top of palette cleanup).

I can also resubmit these in a more sensible order (palette cleanup, then the other three squashed together) if you prefer.

-- >8 -- add--interactive: colorize split hunk fragment headers

The only diff element which we still color in perl is the "fraginfo" for the split hunks. When honoring color.diff without color.interactive, we were failing to actually color this because the "colored" function checks for interactive color. Instead, let's just color it by hand (the simple approach is OK because we know we have a single line string).

Signed-off-by: Jeff King <peff@peff.net>
---
This is a little uglier than it could be because the "colored" function
does two things: correctly colorize a string, and check the global
$use_color. We could do something like:
  local $use_color = 1;
  $display_head = colored($fraginfo_color, $head);

which is arguably less ugly. Or we could refactor "colored", which is a larger change.

 git-add--interactive.perl |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 5bdcca8..76dc4e6 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -21,8 +21,8 @@ if ($use_color) {
 	$prompt_color = $repo->get_color("color.interactive.prompt", "bold blue");
 	$header_color = $repo->get_color("color.interactive.header", "bold");
 	$help_color = $repo->get_color("color.interactive.help", "red bold");
-	$normal_color = $repo->get_color("", "reset");
 }
+$normal_color = $repo->get_color("", "reset");
 
 # Do we also set diff colors?
 $diff_use_color = $repo->get_colorbool('color.diff');
@@ -648,7 +648,8 @@ sub split_hunk {
 		my $display_head = $head;
 		unshift @{$hunk->{TEXT}}, $head;
 		if ($diff_use_color) {
-			$display_head = colored($fraginfo_color, $head);
+			$display_head = join('', $fraginfo_color, $head,
+				$normal_color, "\n");
 		}
 		unshift @{$hunk->{DISPLAY}}, $display_head;
 	}
-- 
1.5.4.rc2.1147.gaecdf-dirty
Previous: Jeff KingNext: Junio C Hamano
Message 60 of 72 in “What's in git/spearce.git (stable)”
  1. Shawn O. PearceOct 22, 2007
  2. What's in git.git (stable)Junio C Hamano, Nov 1, 2007
  3. What's in git.git (stable)Junio C Hamano, Nov 4, 2007
  4. What's in git.git (stable)Junio C Hamano, Nov 8, 2007
  5. Pierre HabouzitNov 8, 2007
  6. What's in git.git (stable)Junio C Hamano, Nov 12, 2007
  7. What's in git.git (stable)Junio C Hamano, Nov 15, 2007
  8. What's in git.git (stable)Junio C Hamano, Nov 17, 2007
  9. What's in git.git (stable)Junio C Hamano, Nov 25, 2007
  10. What's in git.git (stable)Junio C Hamano, Dec 1, 2007
  11. What's in git.git (stable)Junio C Hamano, Dec 4, 2007
  12. What's in git.git (stable)Junio C Hamano, Dec 5, 2007
  13. What's in git.git (stable)Junio C Hamano, Dec 7, 2007
  14. What's in git.git (stable)Junio C Hamano, Dec 9, 2007
  15. v1.5.4 plansJunio C Hamano, Dec 10, 2007
  16. Jeff KingDec 10, 2007
  17. Junio C HamanoDec 11, 2007
  18. Junio C HamanoDec 11, 2007
  19. Jeff KingDec 11, 2007
  20. Junio C HamanoDec 11, 2007
  21. Jeff KingDec 11, 2007
  22. Junio C HamanoDec 11, 2007
  23. Jeff KingDec 11, 2007
  24. Jeff KingDec 11, 2007
  25. Jeff KingDec 11, 2007
  26. 2/2 git-svn: get color config from --get-colorboolJeff King, Dec 11, 2007
  27. Eric WongDec 12, 2007
  28. Jeff KingDec 11, 2007
  29. Andreas EricssonDec 11, 2007
  30. Jeff KingDec 11, 2007
  31. Nicolas PitreDec 11, 2007
  32. Johannes SchindelinDec 11, 2007
  33. Nicolas PitreDec 11, 2007
  34. Kristian HøgsbergDec 11, 2007
  35. Junio C HamanoDec 11, 2007
  36. Eric WongDec 12, 2007
  37. Junio C HamanoDec 12, 2007
  38. David D. KilzerDec 12, 2007
  39. David D. KilzerDec 31, 2007
  40. Fix race condition in t9119-git-svn-info.shDavid D. Kilzer, Dec 31, 2007
  41. Junio C HamanoDec 31, 2007
  42. Remove duplication in t9119-git-svn-info.shDavid D. Kilzer, Dec 31, 2007
  43. Eric WongJan 2, 2008
  44. David D. KilzerJan 2, 2008
  45. Junio C HamanoJan 2, 2008
  46. Junio C HamanoJan 2, 2008
  47. What's in git.git (stable frozen)Junio C Hamano, Dec 13, 2007
  48. git-commit: squelch needless message during an empty mergeJunio C Hamano, Dec 13, 2007
  49. Jeff KingDec 13, 2007
  50. Johannes SixtDec 13, 2007
  51. What's in git.git (stable frozen)Junio C Hamano, Dec 17, 2007
  52. What's in git.git (stable frozen)Junio C Hamano, Dec 23, 2007
  53. What's in git.git (stable frozen)Junio C Hamano, Jan 5, 2008
  54. Dan McGeeJan 5, 2008
  55. Junio C HamanoJan 6, 2008
  56. Junio C HamanoJan 6, 2008
  57. Dan McGeeJan 6, 2008
  58. Junio C HamanoJan 6, 2008
  59. Jeff KingJan 6, 2008
  60. Jeff KingJan 6, 2008
  61. Junio C HamanoJan 6, 2008
  62. Jeff KingJan 6, 2008
  63. Junio C HamanoJan 6, 2008
  64. Jeff KingJan 6, 2008
  65. Junio C HamanoJan 6, 2008
  66. Jeff KingJan 7, 2008
  67. Junio C HamanoJan 7, 2008
  68. Paul MackerrasJan 7, 2008
  69. Christian StimmingJan 7, 2008
  70. Junio C HamanoJan 7, 2008
  71. Steffen ProhaskaDec 17, 2007
  72. Junio C HamanoJan 5, 2008

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.