Version: 1:2.13.2
severity 865863 serious
quit

Hi Ian,

Ian Jackson wrote:

> Control: clone -1 -2
> Control: reassign -2 git
> Control: severity -2 serious
> Control: retitle -2 git config --local in non-repo now bombs out
> Control: retitle -1 dgit 3.10 and earlier not compatible with git 2.12-ish

Please cc g...@packages.debian.org the next time you do this.  Otherwise
the message doesn't show up in mail.

> Hi.  We have tripped over an accidental and incompatible change in the
> behaviour of git config --local:
> 
> $ pwd
> /home/ian
> $ dpkg -s git | grep '^Version'
> Version: 1:2.13.1-1
> $ git config --local --get-regexp '.*'
> fatal: BUG: setup_git_env called without repository
> $ echo $?
> 128

Thanks for reporting.  This is fixed by v2.13.2~26^2~1:

commit 25cd291963e4b0fae0eabe7fe02be693702d79bb
Author: Jeff King <p...@peff.net>
Date:   Fri May 12 23:29:31 2017 -0400

    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 versions of Git would blindly try to read or write
    ".git/config". For reading, this would result in a quiet
    failure, since there was no config to read (and thus no
    matching config value). Writing would generally fail
    noisily, since ".git" was unlikely to exist. But since
    b1ef400ee (setup_git_env: avoid blind fall-back to ".git",
    2016-10-20), we catch this in the call to git_pathdup() and
    die with an assertion.

    Dying is the right thing to do, but we should catch the
    problem early and give a more human-friendly error message.

    Note that even without --local, git-config will sometimes
    default to using local repository config (e.g., when
    writing). These cases are already protected by similar
    checks, and covered by a test in t1308.

    Signed-off-by: Jeff King <p...@peff.net>
    Signed-off-by: Junio C Hamano <gits...@pobox.com>

[...]
> Please would you consider returning to the previous behaviour, for
> compatibility with other existing callers of git.

I don't think that that is the right thing to do.  The old behavior
was accidental and broken.  If you simply omit the --local option then
I think that will give you the behavior you are looking for (if I
understand what you are looking for correctly).

That said, I am happy to add a 'Breaks' to ensure smooth upgrades.
Let me know what version to add a Breaks against and I'll add it.

Also, if you have ideas for clarifying the documentation then that
would also be welcome.

Thanks, sincerely,
Jonathan

Reply via email to