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

Re: Forcing git to use a pager without a tty

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jun 25, 2021, 17:42 UTC
Message-ID
<60d6158fcef74_cc8d20834@natae.notmuch>
In-Reply-To
<CAJ-0Oswry0Rry_0ZqZzzVGuzfU-apZnv95LcxQEhm7GVA=uOxA@mail.gmail.com>
Avishay Matayev wrote:
> On Wed, 23 Jun 2021 at 04:57, Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
Show 16 quoted lines
> > Seems like a completely sensible request to me, except I would do it a
> > slightly different place:
> >
> > --- a/pager.c
> > +++ b/pager.c
> > @@ -101,7 +101,7 @@ void prepare_pager_args(struct child_process *pager_process, const char *pager)
> >
> >  void setup_pager(void)
> >  {
> > -       const char *pager = git_pager(isatty(1));
> > +       const char *pager = git_pager(git_env_bool("GIT_PAGER_FORCE", isatty(1)));
> >
> >         if (!pager)
> >                 return;
> >
> > I'm Cc'ing Jonathan Nieder who seems to have toched these lines.
> 
> Well I'm glad to hear you find it sensible, though your patch suggests
> that `GIT_PAGER_FORCE` will be a boolean, while I expect it to be an
> actual pager, which would make more sense IMO.

I just copied the idea from the GitHub issue, I find it simple and easy to implement in the code this way. A GIT_PAGER_FORCE as you suggest would be a bit more complicated.

Either way feel free to provide a patch with whatever approach you think is best.

However, for a proper patch you need to add documentation too (see Documentation/git-var.txt), and preferably some tests.

Cheers.
-- 
Felipe Contreras
Previous: Avishay MatayevNext: Avishay Matayev
Message 4 of 13 in “”
  1. Avishay MatayevJun 22, 2021
  2. Felipe ContrerasJun 23, 2021
  3. Avishay MatayevJun 23, 2021
  4. Felipe ContrerasJun 25, 2021
  5. Avishay MatayevJun 26, 2021
  6. Why empty subject? (was Re: )Bagas Sanjaya, Jun 23, 2021
  7. Avishay MatayevJun 23, 2021
  8. Phillip WoodJun 23, 2021
  9. Phillip WoodJun 23, 2021
  10. Avishay MatayevJun 24, 2021
  11. Ævar Arnfjörð BjarmasonJun 24, 2021
  12. Avishay MatayevJun 26, 2021
  13. Junio C HamanoJun 29, 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.