git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	Bert Wesarg <bert.wesarg@googlemail.com>
Subject: Re: [PATCH 2/2] config: handle conditional include when $GIT_DIR is not set up
Date: Tue, 18 Apr 2017 00:03:05 -0400	[thread overview]
Message-ID: <20170418040305.t4soqhpllhd4f7u7@sigill.intra.peff.net> (raw)
In-Reply-To: <CACsJy8D-=3qPbEO-dq2+Mr-WZ+5RrivkSw9NX7_FhEJFy+59zA@mail.gmail.com>

On Mon, Apr 17, 2017 at 05:07:52PM +0700, Duy Nguyen wrote:

> > You can see the second problem with:
> >
> >   # random external
> >   cat >git-foo <<-\EOF
> >   #!/bin/sh
> >   echo foo
> >   EOF
> >   chmod +x git-foo
> >   PATH=$PWD:$PATH
> >
> >   git init
> >   git config pager.foo 'sed s/^/repo:/'
> >   git -c pager.foo='sed s/^/cmdline:/' foo
> >
> > That command should prefer the cmdline config, but it doesn't.
> 
> I actually had problems seeing the problem, for some reason it didn't
> work for me. I guess I made a mistake somewhere.

I just double-checked it, and the above works for me. <shrug>

> > The fix is something like what's below, which is easy on top of your new
> > options struct. I can wrap it up with a config message and test on top
> > of your series.
> 
> ... anyway I read this last sentence too late and spent too much time
> wrapping your changes in a patch (well most of the time was spent on
> writing a new test actually), so I'm  sending it out too. My test uses
> test-config though (I have given up on dealing with pager and tty).

Thanks for doing that. I had planned to do it myself to avoid making
work for you, but what you posted looks good.

I hadn't thought about tty issues. You'd have to run it under
test_terminal (which isn't even available everywhere). So your
test-config version is probably the best bet.

> Off topic. Back to the pager.foo thing (because I had to fight it a
> bit before giving up). I find it a bit unintuitive that "--paginate"
> forces the pager back to less (or $PAGER) when I say "pager.foo =
> my-favorite-pager". Back when pager.foo is a boolean thing, it makes
> sense for --paginate to override the "to page or not to page"
> decision. But then you added a new meaning too pager.foo (what command
> to run). "--paginate" should respect the command pager.foo specifies
> when its value is a command, I think.

I never noticed that before, and I agree that it's nonsense. Using "-p"
should be unnecessary if you have pager.foo defined (because it already
implies "yes, use the pager"). But if you were to do it anyway, I agree
it should not ignore the configured pager. One might use an extra "-p"
hoping that it would override the tty check, but it doesn't. It's too
late to change that now, I think, but I have been tempted to add a
--paginate-me-harder option. It would be handy for tests.

-Peff

  parent reply	other threads:[~2017-04-18  4:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-14 17:04 includeIf breaks calling dashed externals Bert Wesarg
2017-04-14 17:43 ` Jeff King
2017-04-15 11:49   ` Duy Nguyen
2017-04-16  4:50     ` Jeff King
2017-04-16 10:41       ` [PATCH 1/2] config: prepare to pass more info in git_config_with_options() Nguyễn Thái Ngọc Duy
2017-04-16 10:41         ` [PATCH 2/2] config: handle conditional include when $GIT_DIR is not set up Nguyễn Thái Ngọc Duy
2017-04-16 15:51           ` Jeff King
2017-04-17  2:13             ` Duy Nguyen
2017-04-18  3:56               ` Jeff King
2017-04-17 10:07             ` Duy Nguyen
2017-04-17 10:10               ` [PATCH v2 1/3] config: prepare to pass more info in git_config_with_options() Nguyễn Thái Ngọc Duy
2017-04-17 10:10                 ` [PATCH v2 2/3] config: handle conditional include when $GIT_DIR is not set up Nguyễn Thái Ngọc Duy
2017-04-18  2:49                   ` Junio C Hamano
2017-04-18  2:56                     ` Junio C Hamano
2017-04-18  3:46                       ` Jeff King
2017-04-17 10:10                 ` [PATCH v2 3/3] config: correct file reading order in read_early_config() Nguyễn Thái Ngọc Duy
2017-04-18  3:53                   ` Jeff King
2017-04-18  2:27                 ` [PATCH v2 1/3] config: prepare to pass more info in git_config_with_options() Junio C Hamano
2017-04-18  3:55                   ` Jeff King
2017-04-18  4:51                     ` Junio C Hamano
2017-04-18  3:17               ` [PATCH 2/2] config: handle conditional include when $GIT_DIR is not set up Junio C Hamano
2017-04-18  4:03               ` Jeff King [this message]
2017-04-16 15:31         ` [PATCH 1/2] config: prepare to pass more info in git_config_with_options() Jeff King
2017-04-17  1:42           ` Duy Nguyen

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20170418040305.t4soqhpllhd4f7u7@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=bert.wesarg@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).