Web lists-archives.com

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

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:
> https://github.com/arialdomartini/oh-my-git/blob/42c11f08540949b75bd513e6880a4ce6824a2bcc/base.sh#L52.
> Since this command is invoked every time the prompt is build, I see
> the error message after every single command I run outside of a Git
> repository. While this is more indicative of a code smell in
> oh-my-git, I figured that, as you said, BUG assertions should never
> get hit in the wild. Thanks for the patch!

Ah, thanks for the context. That makes a lot more sense. I do think
oh-my-git should just drop the "--local", which will cause git-config to
follow the usual precedence rules (and it will skip repo-level config
automatically when we are not in a repo).

Since the oh-my-git code only looks for "false", nobody would ever need
to default the value to true in their ~/.gitconfig. But respecting the
usual config rules would mean you could set it to "false" in
~/.gitconfig to turn it off everywhere, but then opt back into it for
specific repos by setting it to "true" there. Probably not a use case
anybody cares that much about, but it's how "git config" was meant to be
used. :)

Anyway, thanks again for reporting the BUG assertion. I'm glad to be
weeding out more cases.