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

Re: [PATCH (topgit) 1/2] Implement setup_pager just like in git

From
Thomas Rast <trast@student.ethz.ch>
Date
Jan 7, 2009, 12:24 UTC
Message-ID
<200901071324.57222.trast@student.ethz.ch>
In-Reply-To
<20090107112754.GA15158@roro3>
Kirill Smelkov wrote:
Show 14 quoted lines
> On Tue, Jan 06, 2009 at 09:32:03PM +0100, martin f krafft wrote:
> > I find this very confusing. Why not simply
> > 
> >   TG_PAGER="${GIT_PAGER:-}"
> >   TG_PAGER="${TG_PAGER:-$PAGER}"
> > 
> > ?
> 
> I find it confusing too, but this is needed because they usually do
> something like this
> 
>     $ GIT_PAGER='' <some-git-command>
> 
> to force it to be pagerless.
[...]
> So I think it would be better to preserve the same semantics for `tg
> patch` callers, though it's a pity that it's hard (maybe I'm wrong ?) to
> see whether an env var is unset.

Admittedly I haven't really studied your patch, but the ${} constructs can in fact tell empty from unset:

  $ EMPTY=
  $ unset UNDEFINED
  $ echo ${UNDEFINED-foo}
  foo
  $ echo ${UNDEFINED:-foo}
  foo
  $ echo ${EMPTY-foo}
  $ echo ${EMPTY:-foo}
  foo
'man bash' indeed says
  When not performing substring expansion, bash tests for a parameter
  that is unset or null; omitting the colon results in a test only for
  a parameter that is unset.
So I suppose you could use
  ${GIT_PAGER-${PAGER-less}}
or similar.
-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Kirill SmelkovNext: Bert Wesarg
Message 6 of 14 in “tg-patch: fix pagination”
  1. 0/2 tg-patch: fix paginationKirill Smelkov, Jan 6, 2009
  2. 1/2 Implement setup_pager just like in gitKirill Smelkov, Jan 6, 2009
  3. martin f krafftJan 6, 2009
  4. Adeodato SimóJan 7, 2009
  5. Kirill SmelkovJan 7, 2009
  6. Thomas RastJan 7, 2009
  7. Bert WesargJan 7, 2009
  8. Pierre HabouzitJan 7, 2009
  9. Petr BaudisJan 7, 2009
  10. Kirill SmelkovJan 7, 2009
  11. martin f krafftJan 8, 2009
  12. Kirill SmelkovJan 8, 2009
  13. 2/2 tg-patch: fix paginationKirill Smelkov, Jan 6, 2009
  14. Kirill SmelkovJan 18, 2009

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.