<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/ident.c, branch v2.0.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.0.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.0.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2013-10-28T17:43:32Z</updated>
<entry>
<title>Merge branch 'jk/split-broken-ident'</title>
<updated>2013-10-28T17:43:32Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-10-28T17:43:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2125261b631c429175821299ece33449dbd3ab96'/>
<id>urn:sha1:2125261b631c429175821299ece33449dbd3ab96</id>
<content type='text'>
Make the fall-back parsing of commit objects with broken author or
committer lines more robust to pick up the timestamps.

* jk/split-broken-ident:
  split_ident: parse timestamp from end of line
</content>
</entry>
<entry>
<title>split_ident: parse timestamp from end of line</title>
<updated>2013-10-15T17:41:49Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2013-10-14T22:45:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=03818a4a94cbe8154eae433892e92d58d215dade'/>
<id>urn:sha1:03818a4a94cbe8154eae433892e92d58d215dade</id>
<content type='text'>
Split_ident currently parses left to right. Given this
input:

  Your Name &lt;email@example.com&gt; 123456789 -0500\n

We assume the name starts the line and runs until the first
"&lt;".  That starts the email address, which runs until the
first "&gt;".  Everything after that is assumed to be the
timestamp.

This works fine in the normal case, but is easily broken by
corrupted ident lines that contain an extra "&gt;". Some
examples seen in the wild are:

  1. Name &lt;email&gt;-&lt;&gt; 123456789 -0500\n

  2. Name &lt;email&gt; &lt;Name&lt;email&gt;&gt; 123456789 -0500\n

  3. Name1 &lt;email1&gt;, Name2 &lt;email2&gt; 123456789 -0500\n

Currently each of these produces some email address (which
is not necessarily the one the user intended) and end up
with a NULL date (which is generally interpreted as the
epoch by "git log" and friends).

But in each case we could get the correct timestamp simply
by parsing from the right-hand side, looking backwards for
the final "&gt;", and then reading the timestamp from there.

In general, it's a losing battle to try to automatically
guess what the user meant with their broken crud. But this
particular workaround is probably worth doing.  One, it's
dirt simple, and can't impact non-broken cases. Two, it
doesn't catch a single breakage we've seen, but rather a
large class of errors (i.e., any breakage inside the email
angle brackets may affect the email, but won't spill over
into the timestamp parsing). And three, the timestamp is
arguably more valuable to get right, because it can affect
correctness (e.g., in --until cutoffs).

This patch implements the right-to-left scheme described
above. We adjust the tests in t4212, which generate a commit
with such a broken ident, and now gets the timestamp right.
We also add a test that fsck continues to detect the
breakage.

For reference, here are pointers to the breakages seen (as
numbered above):

[1] http://article.gmane.org/gmane.comp.version-control.git/221441

[2] http://article.gmane.org/gmane.comp.version-control.git/222362

[3] http://perl5.git.perl.org/perl.git/commit/13b79730adea97e660de84bbe67f9d7cbe344302

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>format-patch: print in-body "From" only when needed</title>
<updated>2013-09-20T18:09:51Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2013-09-20T10:16:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=662cc30cd048f2ccd7ba8d1540e0768ae264c0dd'/>
<id>urn:sha1:662cc30cd048f2ccd7ba8d1540e0768ae264c0dd</id>
<content type='text'>
Commit a908047 taught format-patch the "--from" option,
which places the author ident into an in-body from header,
and uses the committer ident in the rfc822 from header.  The
documentation claims that it will omit the in-body header
when it is the same as the rfc822 header, but the code never
implemented that behavior.

This patch completes the feature by comparing the two idents
and doing nothing when they are the same (this is the same
as simply omitting the in-body header, as the two are by
definition indistinguishable in this case). This makes it
reasonable to turn on "--from" all the time (if it matches
your particular workflow), rather than only using it when
exporting other people's patches.

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>Merge branch 'jn/do-not-drop-username-when-reading-from-etc-mailname'</title>
<updated>2013-02-01T20:40:05Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-02-01T20:40:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a14daf8b9101225792341e4354699c5a2e30449a'/>
<id>urn:sha1:a14daf8b9101225792341e4354699c5a2e30449a</id>
<content type='text'>
We used to stuff "user@" and then append what we read from
/etc/mailname to come up with a default e-mail ident, but a bug
lost the "user@" part.  This is to fix it.

* jn/do-not-drop-username-when-reading-from-etc-mailname:
  ident: do not drop username when reading from /etc/mailname
</content>
</entry>
<entry>
<title>ident: do not drop username when reading from /etc/mailname</title>
<updated>2013-01-25T18:41:49Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2013-01-24T23:21:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dc342a25d1b48cb53448fe0e5dde578edce3122c'/>
<id>urn:sha1:dc342a25d1b48cb53448fe0e5dde578edce3122c</id>
<content type='text'>
An earlier conversion from fgets() to strbuf_getline() in the
codepath to read from /etc/mailname to learn the default host-part
of the ident e-mail address forgot that strbuf_getline() stores the
line at the beginning of the buffer just like fgets().

The "username@" the caller has prepared in the strbuf, expecting the
function to append the host-part to it, was lost because of this.

Reported-by: Mihai Rusu &lt;dizzy@google.com&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Acked-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 separate "explicit" flags for author and committer</title>
<updated>2012-11-16T01:47:24Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2012-11-15T00:34:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d6991ceedc6a6fbcc2184f8328eb1b4c88b55267'/>
<id>urn:sha1:d6991ceedc6a6fbcc2184f8328eb1b4c88b55267</id>
<content type='text'>
We keep track of whether the user ident was given to us
explicitly, or if we guessed at it from system parameters
like username and hostname. However, we kept only a single
variable. This covers the common cases (because the author
and committer will usually come from the same explicit
source), but can miss two cases:

  1. GIT_COMMITTER_* is set explicitly, but we fallback for
     GIT_AUTHOR. We claim the ident is explicit, even though
     the author is not.

  2. GIT_AUTHOR_* is set and we ask for author ident, but
     not committer ident. We will claim the ident is
     implicit, even though it is explicit.

This patch uses two variables instead of one, updates both
when we set the "fallback" values, and updates them
individually when we read from the environment.

Rather than keep user_ident_sufficiently_given as a
compatibility wrapper, we update the only two callers to
check the committer_ident, which matches their intent and
what was happening already.

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 user_ident_explicitly_given static</title>
<updated>2012-11-16T01:47:24Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2012-11-15T00:34:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=452802309c422ce71f1c038357ee0775af5fb3eb'/>
<id>urn:sha1:452802309c422ce71f1c038357ee0775af5fb3eb</id>
<content type='text'>
In v1.5.6-rc0~56^2 (2008-05-04) "user_ident_explicitly_given"
was introduced as a global for communication between config,
ident, and builtin-commit.  In v1.7.0-rc0~72^2 (2010-01-07)
readers switched to using the common wrapper
user_ident_sufficiently_given().  After v1.7.11-rc1~15^2~18
(2012-05-21), the var is only written in ident.c.

Now we can make it static, which will enable further
refactoring without worrying about upsetting other code.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Reviewed-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ident.c: mark private file-scope symbols as static</title>
<updated>2012-09-16T05:58:21Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2012-09-16T05:50:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dad148c35975923c7a13058c20e01bb587ace4ef'/>
<id>urn:sha1:dad148c35975923c7a13058c20e01bb587ace4ef</id>
<content type='text'>
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>split_ident_line(): make best effort when parsing author/committer line</title>
<updated>2012-08-31T21:54:18Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2012-08-31T21:54:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e27ddb64568412b75035a05366c9f091153155ed'/>
<id>urn:sha1:e27ddb64568412b75035a05366c9f091153155ed</id>
<content type='text'>
Commits made by ancient version of Git allowed committer without
human readable name, like this (00213b17c in the kernel history):

    tree 6947dba41f8b0e7fe7bccd41a4840d6de6a27079
    parent 352dd1df32e672be4cff71132eb9c06a257872fe
    author Petr Baudis &lt;pasky@ucw.cz&gt; 1135223044 +0100
    committer  &lt;sam@mars.ravnborg.org&gt; 1136151043 +0100

    kconfig: Remove support for lxdialog --checklist

    ...

    Signed-off-by: Petr Baudis &lt;pasky@suse.cz&gt;
    Signed-off-by: Sam Ravnborg &lt;sam@ravnborg.org&gt;

When fed such a commit, --format='%ci' fails to parse it, and gives
back an empty string.  Update the split_ident_line() to be a bit
more lenient when parsing, but make sure the caller that wants to
pick up sane value from its return value does its own validation.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/ident-gecos-strbuf'</title>
<updated>2012-05-29T20:09:13Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2012-05-29T20:09:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=261ec7d02ae25ba1f5532645fa6fd790515bfa70'/>
<id>urn:sha1:261ec7d02ae25ba1f5532645fa6fd790515bfa70</id>
<content type='text'>
Fixes quite a lot of brokenness when ident information needs to be taken
from the system and cleans up the code.

By Jeff King
* jk/ident-gecos-strbuf: (22 commits)
  format-patch: do not use bogus email addresses in message ids
  ident: reject bogus email addresses with IDENT_STRICT
  ident: rename IDENT_ERROR_ON_NO_NAME to IDENT_STRICT
  format-patch: use GIT_COMMITTER_EMAIL in message ids
  ident: let callers omit name with fmt_indent
  ident: refactor NO_DATE flag in fmt_ident
  ident: reword empty ident error message
  format-patch: refactor get_patch_filename
  ident: trim whitespace from default name/email
  ident: use a dynamic strbuf in fmt_ident
  ident: use full dns names to generate email addresses
  ident: report passwd errors with a more friendly message
  drop length limitations on gecos-derived names and emails
  ident: don't write fallback username into git_default_name
  fmt_ident: drop IDENT_WARN_ON_NO_NAME code
  format-patch: use default email for generating message ids
  ident: trim trailing newline from /etc/mailname
  move git_default_* variables to ident.c
  move identity config parsing to ident.c
  fmt-merge-msg: don't use static buffer in record_person
  ...
</content>
</entry>
</feed>
