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

Re: [PATCH v2 1/2] test-lib: extend test_decode_color to handle more color codes

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 20, 2010, 23:40 UTC
Message-ID
<7v39s0v3f5.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1287613046-61804-1-git-send-email-kevin@sb.org>
Kevin Ballard <kevin@sb.org> writes:
Show 12 quoted lines
> Enhance the test_decode_color function to handle all common color codes,
> including background colors and escapes that contain multiple codes.
> This change necessitates changing <WHITE> to <BOLD>, so update t4034
> as well.
>
> This change is necessary for the next commit in order to test
> background colors properly.
>
> Signed-off-by: Kevin Ballard <kevin@sb.org>
> ---
> I turned sed into awk. Looks like awk is already used elsehwere in git,
> so I'm assuming this is safe, but please let me know if it's not.

I think calling BOLD BOLD is the right thing to do (who came up with the bogus WHITE in the first place anyway---my terminal is black letters on white background, thank you).

Even though some scripts seem to already use awk, they are all used for very small and trivial processing without exercising anything remotely fancy e.g. hexadecimal \xXX quoting or match() function, so I wouldn't be surprised if we see breakage reports from minority platforms.

But I do not think of a trivial way to express combination of attributes by extending the existing sed script (we can write loops and do the same computation as your awk script does, but it does not reduce the complexity nor risk of portability issues), so let's see what happens. We already use Perl everywhere, which we might end up using for this if there are platforms that have issues with your awk script.

Thanks.
Previous: Kevin BallardNext: Kevin Ballard
Message 7 of 9 in “diff: handle lines containing only whitespace better”
  1. diff: handle lines containing only whitespace betterKevin Ballard, Oct 20, 2010
  2. Junio C HamanoOct 20, 2010
  3. Kevin BallardOct 20, 2010
  4. Nazri RamliyOct 20, 2010
  5. Junio C HamanoOct 20, 2010
  6. 1/2 test-lib: extend test_decode_color to handle more color codesKevin Ballard, Oct 20, 2010
  7. Junio C HamanoOct 20, 2010
  8. Kevin BallardOct 21, 2010
  9. 2/2 diff: handle lines containing only whitespace and tabs betterKevin Ballard, Oct 20, 2010

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.