<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/ident.c, branch v2.6.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.6.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.6.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-09-19T18:38:33Z</updated>
<entry>
<title>Merge branch 'jk/commit-author-parsing'</title>
<updated>2014-09-19T18:38:33Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-09-19T18:38:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9ff700ebacffc8fb8cf80daabfb6503cb24dca0b'/>
<id>urn:sha1:9ff700ebacffc8fb8cf80daabfb6503cb24dca0b</id>
<content type='text'>
Code clean-up.

* jk/commit-author-parsing:
  determine_author_info(): copy getenv output
  determine_author_info(): reuse parsing functions
  date: use strbufs in date-formatting functions
  record_author_date(): use find_commit_header()
  record_author_date(): fix memory leak on malformed commit
  commit: provide a function to find a header in a buffer
</content>
</entry>
<entry>
<title>date: use strbufs in date-formatting functions</title>
<updated>2014-08-27T17:32:56Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-08-27T07:57:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c33ddc2e33d51da9391a81206a1d9e4a92d97d10'/>
<id>urn:sha1:c33ddc2e33d51da9391a81206a1d9e4a92d97d10</id>
<content type='text'>
Many of the date functions write into fixed-size buffers.
This is a minor pain, as we have to take special
precautions, and frequently end up copying the result into a
strbuf or heap-allocated buffer anyway (for which we
sometimes use strcpy!).

Let's instead teach parse_date, datestamp, etc to write to a
strbuf. The obvious downside is that we might need to
perform a heap allocation where we otherwise would not need
to. However, it turns out that the only two new allocations
required are:

  1. In test-date.c, where we don't care about efficiency.

  2. In determine_author_info, which is not performance
     critical (and where the use of a strbuf will help later
     refactoring).

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>config --global --edit: create a template file if needed</title>
<updated>2014-07-25T19:23:06Z</updated>
<author>
<name>Matthieu Moy</name>
<email>Matthieu.Moy@imag.fr</email>
</author>
<published>2014-07-25T19:11:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9830534e40bd15231357965441d4fe02a6a4810e'/>
<id>urn:sha1:9830534e40bd15231357965441d4fe02a6a4810e</id>
<content type='text'>
When the user has no ~/.gitconfig file, git config --global --edit used
to launch an editor on an nonexistant file name.

Instead, create a file with a default content before launching the
editor. The template contains only commented-out entries, to save a few
keystrokes for the user. If the values are guessed properly, the user
will only have to uncomment the entries.

Advanced users teaching newbies can create a minimalistic configuration
faster for newbies. Beginners reading a tutorial advising to run "git
config --global --edit" as a first step will be slightly more guided for
their first contact with Git.

Signed-off-by: Matthieu Moy &lt;Matthieu.Moy@imag.fr&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<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>
</feed>
