<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/ident.c, branch v2.8.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.8.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.8.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2016-02-17T18:13:31Z</updated>
<entry>
<title>Merge branch 'da/user-useconfigonly'</title>
<updated>2016-02-17T18:13:31Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-02-17T18:13:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c37f9a1bc38cad56c9eca40014802e7cd822c21c'/>
<id>urn:sha1:c37f9a1bc38cad56c9eca40014802e7cd822c21c</id>
<content type='text'>
The "user.useConfigOnly" configuration variable can be used to
force the user to always set user.email &amp; user.name configuration
variables, serving as a reminder for those who work on multiple
projects and do not want to put these in their $HOME/.gitconfig.

* da/user-useconfigonly:
  ident: add user.useConfigOnly boolean for when ident shouldn't be guessed
  fmt_ident: refactor strictness checks
</content>
</entry>
<entry>
<title>ident: add user.useConfigOnly boolean for when ident shouldn't be guessed</title>
<updated>2016-02-08T19:06:28Z</updated>
<author>
<name>Dan Aloni</name>
<email>alonid@gmail.com</email>
</author>
<published>2016-02-06T06:23:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4d5c2956969a6690db2bbb2f3ff40459c09d7646'/>
<id>urn:sha1:4d5c2956969a6690db2bbb2f3ff40459c09d7646</id>
<content type='text'>
It used to be that:

   git config --global user.email "(none)"

was a viable way for people to force themselves to set user.email in
each repository.  This was helpful for people with more than one
email address, targeting different email addresses for different
clones, as it barred git from creating a commit unless the user.email
config was set in the per-repo config to the correct email address.

A recent change, 19ce497c (ident: keep a flag for bogus
default_email, 2015-12-10), however, declared that an explicitly
configured user.email is not bogus, no matter what its value is, so
this hack no longer works.

Provide the same functionality by adding a new configuration
variable user.useConfigOnly; when this variable is set, the
user must explicitly set user.email configuration.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Helped-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Dan Aloni &lt;alonid@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fmt_ident: refactor strictness checks</title>
<updated>2016-02-04T21:18:48Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-02-04T09:12:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=59f929596b611d88270ac0fd3ea132b32d66d460'/>
<id>urn:sha1:59f929596b611d88270ac0fd3ea132b32d66d460</id>
<content type='text'>
This function has evolved quite a bit over time, and as a
result, the logic for "is this an OK ident" has been
sprinkled throughout. This ends up with a lot of redundant
conditionals, like checking want_name repeatedly. Worse,
we want to know in many cases whether we are using the
"default" ident, and we do so by comparing directly to the
global strbuf, which violates the abstraction of the
ident_default_* functions.

Let's reorganize the function into a hierarchy of
conditionals to handle similar cases together. The only
case that doesn't just work naturally for this is that of an
empty name, where our advice is different based on whether
we came from ident_default_name() or not. We can use a
simple flag to cover this case.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ident.c: read /etc/mailname with strbuf_getline()</title>
<updated>2016-01-15T18:34:41Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-10-28T20:24:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1f3b1efd18a935fed41431132c67cde5a94833ae'/>
<id>urn:sha1:1f3b1efd18a935fed41431132c67cde5a94833ae</id>
<content type='text'>
Just in case /etc/mailname file was edited with a DOS editor,
read it with strbuf_getline() so that a stray CR is not included
as the last character of the mail hostname.

We _might_ want to more aggressively discard whitespace characters
around the line with strbuf_trim(), but that is a bit outside the
scope of this series.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>strbuf: introduce strbuf_getline_{lf,nul}()</title>
<updated>2016-01-15T18:12:51Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-01-13T23:31:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8f309aeb8225a9c26f20c0dbc031f1ea8df75d49'/>
<id>urn:sha1:8f309aeb8225a9c26f20c0dbc031f1ea8df75d49</id>
<content type='text'>
The strbuf_getline() interface allows a byte other than LF or NUL as
the line terminator, but this is only because I wrote these
codepaths anticipating that there might be a value other than NUL
and LF that could be useful when I introduced line_termination long
time ago.  No useful caller that uses other value has emerged.

By now, it is clear that the interface is overly broad without a
good reason.  Many codepaths have hardcoded preference to read
either LF terminated or NUL terminated records from their input, and
then call strbuf_getline() with LF or NUL as the third parameter.

This step introduces two thin wrappers around strbuf_getline(),
namely, strbuf_getline_lf() and strbuf_getline_nul(), and
mechanically rewrites these call sites to call either one of
them.  The changes contained in this patch are:

 * introduction of these two functions in strbuf.[ch]

 * mechanical conversion of all callers to strbuf_getline() with
   either '\n' or '\0' as the third parameter to instead call the
   respective thin wrapper.

After this step, output from "git grep 'strbuf_getline('" would
become a lot smaller.  An interim goal of this series is to make
this an empty set, so that we can have strbuf_getline_crlf() take
over the shorter name strbuf_getline().

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/ident-loosen-getpwuid'</title>
<updated>2015-12-21T18:59:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-12-21T18:59:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5498c57cdd637eb4f42ce8e296ce9ca4ab66e289'/>
<id>urn:sha1:5498c57cdd637eb4f42ce8e296ce9ca4ab66e289</id>
<content type='text'>
When getpwuid() on the system returned NULL (e.g. the user is not
in the /etc/passwd file or other uid-to-name mappings), the
codepath to find who the user is to record it in the reflog barfed
and died.  Loosen the check in this codepath, which already accepts
questionable ident string (e.g. host part of the e-mail address is
obviously bogus), and in general when we operate fmt_ident() function
in non-strict mode.

* jk/ident-loosen-getpwuid:
  ident: loosen getpwuid error in non-strict mode
  ident: keep a flag for bogus default_email
  ident: make xgetpwuid_self() a static local helper
</content>
</entry>
<entry>
<title>ident: fix undefined variable when NO_IPV6 is set</title>
<updated>2015-12-14T21:06:00Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-12-14T20:52:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=58d29ececf8fc287d9b244c617edd174ded66b01'/>
<id>urn:sha1:58d29ececf8fc287d9b244c617edd174ded66b01</id>
<content type='text'>
Commit 00bce77 (ident.c: add support for IPv6, 2015-11-27)
moved the "gethostbyname" call out of "add_domainname" and
into the helper function "canonical_name". But when moving
the code, it forgot that the "buf" variable is passed as
"host" in the helper.

Reported-by: johan defries &lt;johandefries@gmail.com&gt;
Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ident: loosen getpwuid error in non-strict mode</title>
<updated>2015-12-14T19:44:38Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-12-10T21:41:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=92bcbb9b338dd27f0fd4245525093c4bce867f3d'/>
<id>urn:sha1:92bcbb9b338dd27f0fd4245525093c4bce867f3d</id>
<content type='text'>
If the user has not specified an identity and we have to
turn to getpwuid() to find the username or gecos field, we
die immediately when getpwuid fails (e.g., because the user
does not exist). This is OK for making a commit, where we
have set IDENT_STRICT and would want to bail on bogus input.

But for something like a reflog, where the ident is "best
effort", it can be pain. For instance, even running "git
clone" with a UID that is not in /etc/passwd will result in
git barfing, just because we can't find an ident to put in
the reflog.

Instead of dying in xgetpwuid_self, we can instead return a
fallback value, and set a "bogus" flag. For the username in
an email, we already have a "default_email_is_bogus" flag.
For the name field, we introduce (and check) a matching
"default_name_is_bogus" flag. As a bonus, this means you now
get the usual "tell me who you are" advice instead of just a
"no such user" error.

No tests, as this is dependent on configuration outside of
git's control. However, I did confirm that it behaves
sensibly when I delete myself from the local /etc/passwd
(reflogs get written, and commits complain).

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ident: keep a flag for bogus default_email</title>
<updated>2015-12-10T23:39:25Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-12-10T21:35:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=19ce497cf594a3c01af33a65b27b19e7459212d6'/>
<id>urn:sha1:19ce497cf594a3c01af33a65b27b19e7459212d6</id>
<content type='text'>
If we have to deduce the user's email address and can't come
up with something plausible for the hostname, we simply
write "(none)" or ".(none)" in the hostname.

Later, our strict-check is forced to use strstr to look for
this magic string. This is probably not a problem in
practice, but it's rather ugly. Let's keep an extra flag
that tells us the email is bogus, and check that instead.

We could get away with simply setting the global in
add_domainname(); it only gets called to write into
git_default_email. However, let's make the code a little
more obvious to future readers by actually passing a pointer
to our "bogus" flag down the call-chain.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ident: make xgetpwuid_self() a static local helper</title>
<updated>2015-12-10T23:38:59Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-12-10T21:33:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e850194c83985396435b01b70d2db00b6d3af02e'/>
<id>urn:sha1:e850194c83985396435b01b70d2db00b6d3af02e</id>
<content type='text'>
This function is defined in wrapper.c, but nobody besides
ident.c uses it. And nobody is likely to in the future,
either, as anything that cares about the user's name should
be going through the ident code.

Moving it here is a cleanup of the global namespace, but it
will also enable further cleanups inside ident.c.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
