Re: [PATCH] config: complain about --local outside of a git repo

2017-05-14 Thread Jeff King
On Sun, May 14, 2017 at 08:31:54PM -0400, Josh Hagins wrote: > For context, the "user.name" bit was purely notional; I just wanted to > give a sample reproduction. Where I've actually been running into this > in real life is with oh-my-git, a GitHub-themed Powerline bash prompt: >

Re: [PATCH] config: complain about --local outside of a git repo

2017-05-14 Thread Josh Hagins
tly what you wanted to accomplish with --local. If you > just want to know if user.name is set anywhere (and you may or may not > be in a git repo), then just "git config --get user.name" would work. If > you want to know if you're in a local repo and if so whether the > varia

Re: [PATCH] config: complain about --local outside of a git repo

2017-05-12 Thread Jeff King
On Fri, May 12, 2017 at 05:04:42PM -0700, Jonathan Nieder wrote: > > diff --git a/builtin/config.c b/builtin/config.c > > index 3a554ad50..ad7c6a19c 100644 > > --- a/builtin/config.c > > +++ b/builtin/config.c > > @@ -496,6 +496,9 @@ int cmd_config(int argc, const char **argv, const char > >

Re: [PATCH] config: complain about --local outside of a git repo

2017-05-12 Thread Jeff King
On Sat, May 13, 2017 at 12:31:31AM +0200, Ævar Arnfjörð Bjarmason wrote: > > + if (use_local_config && nongit) > > + die(_("--local only be used inside a git repository")); > > + > > It would be better to have a test for edge cases that are currently > only being discovered

Re: [PATCH] config: complain about --local outside of a git repo

2017-05-12 Thread Jonathan Nieder
Jeff King wrote: > Subject: [PATCH] config: complain about --local outside of a git repo > > The "--local" option instructs git-config to read or modify > the repository-level config. This doesn't make any sense if > you're not actually in a repository. > > Older ve

Re: [PATCH] config: complain about --local outside of a git repo

2017-05-12 Thread Ævar Arnfjörð Bjarmason
ust want to know if user.name is set anywhere (and you may or may not > be in a git repo), then just "git config --get user.name" would work. If > you want to know if you're in a local repo and if so whether the > variable is set, you'd need to use two commands, like: > > git

[PATCH] config: complain about --local outside of a git repo

2017-05-12 Thread Jeff King
whether the variable is set, you'd need to use two commands, like: git rev-parse --git-dir >/dev/null 2>&1 && git config --local --get user.name -- >8 -- Subject: [PATCH] config: complain about --local outside of a git repo The "--local" option instructs git