Re: [PATCH 4/4] ident: do not ignore empty config name/email
- From
Jeff King <peff@peff.net>
- Date
- Feb 24, 2017, 01:08 UTC
- Message-ID
- <20170224010823.my4wmdyezjuqajfx@sigill.intra.peff.net>
- In-Reply-To
- <xmqqfuj47hfk.fsf@gitster.mtv.corp.google.com>
On Thu, Feb 23, 2017 at 12:58:39PM -0800, Junio C Hamano wrote:
Show 11 quoted lines
> Jeff King <peff@peff.net> writes: > > > This one is perhaps questionable. Maybe somebody is relying on setting a > > per-repo user.name to override a ~/.gitconfig value and enforce > > auto-detection? > > Thanks for splitting this step out. 1/4 and 2/4 are obvious > improvements, and 3/4 is a very sensible fix. Compared to those > three, this one does smell questionable, because I do not quite see > any other reasonable fallback other than the auto-detection if the > user gives an empty ident on purpose.
The outcomes are basically:
1. In strict mode (making a commit, etc), we'll die with "empty name
not allowed". My thinking was that this is less confusing for the
user. 2. In non-strict mode, we'd use a blank name instead of trying your
username (or dying if you don't have an /etc/passwd entry).Show 7 quoted lines
> Erroring out to say "don't do that" is probably not too bad, but > perhaps we are being run by a script that is doing a best-effort > conversion from $ANOTHER_SCM using a list of known authors that is > incomplete, ending up feeding empty ident and allowing us to fall > back to attribute them to the user who runs the script. I do not > see a point in breaking that user and having her or him update the > script to stuff in a truly bogus "Unknown <unknown>" name.
Keep in mind this _only_ affects Git's config variables. So a script feeding git via GIT_AUTHOR_NAME, etc, shouldn't change at all with this code. If your script is doing "git -c user.name=whatever commit", I think you should reconsider your script. :)
So I dunno. I could really go either way on it. Feel free to drop it, or even move it into a separate topic to be cooked longer.
-Peff