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

Re: [PATCH v2] column: show auto columns when pager is active

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 17, 2017, 03:19 UTC
Message-ID
<xmqqtvyypikn.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20171016183511.12528-1-me@ikke.info>
Kevin Daudt <me@ikke.info> writes:
Show 21 quoted lines
> When columns are set to automatic for git tag and the output is
> paginated by git, the output is a single column instead of multiple
> columns.
>
> Standard behaviour in git is to honor auto values when the pager is
> active, which happens for example with commands like git log showing
> colors when being paged.
>
> Since ff1e72483 (tag: change default of `pager.tag` to "on",
> 2017-08-02), the pager has been enabled by default, exposing this
> problem to more people.
>
> finalize_colopts in column.c only checks whether the output is a TTY to
> determine if columns should be enabled with columns set to auto. Also
> check if the pager is active.
>
> Adding a test for git column is possible but requires some care to work
> around a race on stdin. See commit 18d8c2693 (test_terminal: redirect
> child process' stdin to a pty, 2015-08-04). Test git tag instead, since
> that does not involve stdin, and since that was the original motivation
> for this patch.
Nicely done.
Show 13 quoted lines
> +test_expect_success TTY 'git tag with auto-columns ' '
> +	test_commit one &&
> +	test_commit two &&
> +	test_commit three &&
> +	test_commit four &&
> +	test_commit five &&
> +	cat >expected <<\EOF &&
> +initial  one      two      three    four     five
> +EOF
> +	test_terminal env PAGER="cat >actual.tag" COLUMNS=80 \
> +		git -c column.ui=auto tag --sort=authordate &&
> +	test_cmp expected actual.tag
> +'

I'd use <<-\EOF so that here document can be intended like other tests, and also use expect vs actual that are used in the other tests in the same script, instead of suddenly becoming creative in only this single test. I can do these clean-ups locally when queuing so no need to resend only to collect these.

Thanks, will queue.
Previous: Kevin DaudtNext: Jonathan Nieder
Message 17 of 21 in “[RFC] column: show auto columns when pager is active”
  1. Kevin DaudtOct 9, 2017
  2. Eric SunshineOct 9, 2017
  3. Martin ÅgrenOct 10, 2017
  4. Jeff KingOct 10, 2017
  5. Martin ÅgrenOct 10, 2017
  6. Kevin DaudtOct 11, 2017
  7. Jeff KingOct 12, 2017
  8. Jeff KingOct 10, 2017
  9. Jeff KingOct 10, 2017
  10. Martin ÅgrenOct 10, 2017
  11. Kevin DaudtOct 10, 2017
  12. column: show auto columns when pager is activeKevin Daudt, Oct 11, 2017
  13. Martin ÅgrenOct 11, 2017
  14. Kevin DaudtOct 11, 2017
  15. Martin ÅgrenOct 11, 2017
  16. column: show auto columns when pager is activeKevin Daudt, Oct 16, 2017
  17. Junio C HamanoOct 17, 2017
  18. Jonathan NiederOct 23, 2017
  19. Junio C HamanoOct 24, 2017
  20. Jonathan NiederOct 24, 2017
  21. Kevin DaudtOct 24, 2017

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.