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

Re: [PATCH 1/1] diff-highlight: fix a whitespace nit

From
Jeff King <peff@peff.net>
Date
Oct 15, 2019, 04:20 UTC
Message-ID
<20191015042006.GC32308@sigill.intra.peff.net>
In-Reply-To
<2823d4d360b2f53c1d63ba742808eaee80ede1e4.1571110286.git.gitgitgadget@gmail.com>
On Tue, Oct 15, 2019 at 03:31:26AM +0000, Norman Rasmussen via GitGitGadget wrote:
Show 7 quoted lines
> From: Norman Rasmussen <norman@rasmussen.co.za>
> 
> This changes the indent from
>   "<tab><sp><sp><sp><sp><sp><sp><sp><sp>"
> to
>   "<tab><tab>"
> so that the statement lines up with the rest of the block.

Yep, that makes sense. Looks like I introduced the problem (most of my perl used to be written in a style that forbids tabs, so it may have snuck in that way, but the rest of the file definitely follows Git's usual style of tabs).

Show 10 quoted lines
> diff --git a/contrib/diff-highlight/DiffHighlight.pm b/contrib/diff-highlight/DiffHighlight.pm
> index 7440aa1c46..e2589922a6 100644
> --- a/contrib/diff-highlight/DiffHighlight.pm
> +++ b/contrib/diff-highlight/DiffHighlight.pm
> @@ -72,7 +72,7 @@ sub handle_line {
>  	      (?:$COLOR?\|$COLOR?[ ])* # zero or more trailing "|"
>  	                         [ ]*  # trailing whitespace for merges
>  	    /x) {
> -	        my $graph_prefix = $&;
> +		my $graph_prefix = $&;

There are a few lines just above that have 8+ spaces. Arguably those could be tabs, too, depending on your view of tabs. We usually do "8 spaces is a tab" in the Git project, but the oft-repeated "tabs to indent, spaces to align" mantra would apply here (and I suspect you're using a different tabwidth since you noticed this one case). So I'd just as soon leave them be, and take your patch as-is.

-Peff
Previous: Norman Rasmussen via GitGitGadgetNext: Norman Rasmussen
Message 3 of 4 in “diff-highlight: fix a whitespace nit”
  1. 0/1 diff-highlight: fix a whitespace nitNorman Rasmussen via GitGitGadget, Oct 15, 2019
  2. 1/1 diff-highlight: fix a whitespace nitNorman Rasmussen via GitGitGadget, Oct 15, 2019
  3. Jeff KingOct 15, 2019
  4. Norman RasmussenOct 15, 2019

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.