git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Cc: martin f krafft <madduck@madduck.net>,
	git@vger.kernel.org, pasky@suse.cz
Subject: Re: [PATCH (topgit) 1/2] Implement setup_pager just like in git
Date: Wed, 7 Jan 2009 13:24:44 +0100	[thread overview]
Message-ID: <200901071324.57222.trast@student.ethz.ch> (raw)
In-Reply-To: <20090107112754.GA15158@roro3>

[-- Attachment #1: Type: text/plain, Size: 1198 bytes --]

Kirill Smelkov wrote:
> 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


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2009-01-07 12:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-06 15:16 [PATCH (topgit) 0/2] tg-patch: fix pagination Kirill Smelkov
2009-01-06 15:16 ` [PATCH (topgit) 1/2] Implement setup_pager just like in git Kirill Smelkov
2009-01-06 20:32   ` martin f krafft
2009-01-07 10:35     ` Adeodato Simó
2009-01-07 11:27     ` Kirill Smelkov
2009-01-07 12:24       ` Thomas Rast [this message]
2009-01-07 14:24       ` Bert Wesarg
2009-01-07 14:44       ` Pierre Habouzit
2009-01-07 15:10         ` Petr Baudis
2009-01-07 22:00           ` Kirill Smelkov
2009-01-08  2:06             ` martin f krafft
2009-01-08  9:23               ` Kirill Smelkov
2009-01-06 15:16 ` [PATCH (topgit) 2/2] tg-patch: fix pagination Kirill Smelkov
2009-01-18 15:04 ` [PATCH (topgit) 0/2] " Kirill Smelkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200901071324.57222.trast@student.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=git@vger.kernel.org \
    --cc=kirr@landau.phys.spbu.ru \
    --cc=madduck@madduck.net \
    --cc=pasky@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).