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

Re: [PATCH] status: fix verbose status coloring inconsistency

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Feb 5, 2021, 07:17 UTC
Message-ID
<CAPig+cRos+wGuwqbjuAV11kM5U0TPbBO9F4o4VJzQ4eZyxArMA@mail.gmail.com>
In-Reply-To
<xmqqa6skbw9u.fsf@gitster.c.googlers.com>
On Wed, Feb 3, 2021 at 5:51 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 7 quoted lines
> "Lance Ward via GitGitGadget" <gitgitgadget@gmail.com> writes:
> >  t/t7527-status-color-pipe.sh | 55 ++++++++++++++++++++++++++++++++++++
>
> Don't we already have test that checks "status" output including its
> coloring already? I'd rather see us adding to existing test script,
> than allocating a new number for a small subset of features being
> tested for a command.  After all, test numbers are limited resource.
t7508 seems like a good place for these tests.
Show 7 quoted lines
> > +test_expect_success 'git status' '
> > +     git status >raw &&
> > +     test_decode_color <raw >out &&
> > +     grep "original$" out
> > +'
>
> Not "new file: *original$" or something less false-positive prone?

The "new file:" message is localized, so this `grep` will need to become `test_i18ngrep` again (as it was in the original submission) if this approach is adopted, which is fine.

Show 9 quoted lines
> > +test_expect_success 'git -c color.status=never status' '
> > +     git -c color.status=never status >raw &&
> > +     test_decode_color <raw >out &&
> > +     grep "original$" out
> > +'
>
> Would it make sense to have tests for color.status=true, I wonder.
> It requires tty to actually "see" the colors output but sending
> the output to tty is the normal use case, so we should care...

I wondered if `color.status=true` might already be tested by t7508 but apparently it only checks `auto`.

Show 8 quoted lines
> > +test_expect_success 'git -c color.status=always status -v' '
> > +     git -c color.status=always status -v >raw &&
> > +     test_decode_color <raw >out &&
> > +     grep "<CYAN>@@ -0,0 +1 @@<RESET>" out &&
> > +     grep "GREEN>+<RESET><GREEN>1<RESET>" out
> > +'
>
> Are we forcing the standard palette?

As this is a stand-alone test script with a well-controlled initial configuration, I expect it would be using the default palette. t7508 does assign a custom palette for `color.status` but not, apparently, for `color.diff`, so it presumably should be okay there, as well.

Previous: Eric Sunshine
Message 5 of 5 in “status: fix verbose status coloring inconsistency”
  1. status: fix verbose status coloring inconsistencyLance Ward via GitGitGadget, Feb 3, 2021
  2. Junio C HamanoFeb 3, 2021
  3. Lance WardFeb 4, 2021
  4. Eric SunshineFeb 5, 2021
  5. Eric SunshineFeb 5, 2021

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.