<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/combine-diff.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>2015-09-28T22:33:56Z</updated>
<entry>
<title>Sync with 2.4.10</title>
<updated>2015-09-28T22:33:56Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-09-28T22:33:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=11a458befcd7662fbe6d2d53c76d49ae2b0fe219'/>
<id>urn:sha1:11a458befcd7662fbe6d2d53c76d49ae2b0fe219</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Sync with 2.3.10</title>
<updated>2015-09-28T22:28:31Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-09-28T22:28:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6343e2f6f271cf344ea8e7384342502faecaf37c'/>
<id>urn:sha1:6343e2f6f271cf344ea8e7384342502faecaf37c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>react to errors in xdi_diff</title>
<updated>2015-09-28T21:57:10Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-09-24T23:12:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3efb988098858bf6b974b1e673a190f9d2965d1d'/>
<id>urn:sha1:3efb988098858bf6b974b1e673a190f9d2965d1d</id>
<content type='text'>
When we call into xdiff to perform a diff, we generally lose
the return code completely. Typically by ignoring the return
of our xdi_diff wrapper, but sometimes we even propagate
that return value up and then ignore it later.  This can
lead to us silently producing incorrect diffs (e.g., "git
log" might produce no output at all, not even a diff header,
for a content-level diff).

In practice this does not happen very often, because the
typical reason for xdiff to report failure is that it
malloc() failed (it uses straight malloc, and not our
xmalloc wrapper).  But it could also happen when xdiff
triggers one our callbacks, which returns an error (e.g.,
outf() in builtin/rerere.c tries to report a write failure
in this way). And the next patch also plans to add more
failure modes.

Let's notice an error return from xdiff and react
appropriately. In most of the diff.c code, we can simply
die(), which matches the surrounding code (e.g., that is
what we do if we fail to load a file for diffing in the
first place). This is not that elegant, but we are probably
better off dying to let the user know there was a problem,
rather than simply generating bogus output.

We could also just die() directly in xdi_diff, but the
callers typically have a bit more context, and can provide a
better message (and if we do later decide to pass errors up,
we're one step closer to doing so).

There is one interesting case, which is in diff_grep(). Here
if we cannot generate the diff, there is nothing to match,
and we silently return "no hits". This is actually what the
existing code does already, but we make it a little more
explicit.

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 'jk/color-diff-plain-is-context'</title>
<updated>2015-06-11T16:29:53Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-06-11T16:29:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=db65170ee5558b47355e7f9f111aecb5b152d4d9'/>
<id>urn:sha1:db65170ee5558b47355e7f9f111aecb5b152d4d9</id>
<content type='text'>
"color.diff.plain" was a misnomer; give it 'color.diff.context' as
a more logical synonym.

* jk/color-diff-plain-is-context:
  diff.h: rename DIFF_PLAIN color slot to DIFF_CONTEXT
  diff: accept color.diff.context as a synonym for "plain"
</content>
</entry>
<entry>
<title>diff.h: rename DIFF_PLAIN color slot to DIFF_CONTEXT</title>
<updated>2015-05-27T20:54:42Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-05-27T20:48:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8dbf3eb6850d6d9495ace908625fe50888b111e6'/>
<id>urn:sha1:8dbf3eb6850d6d9495ace908625fe50888b111e6</id>
<content type='text'>
The latter is a much more descriptive name (and we support
"color.diff.context" now). This also updates the name of any
local variables which were used to store the color.

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>diff: convert struct combine_diff_path to object_id</title>
<updated>2015-03-14T05:43:13Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2015-03-13T23:39:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1ff57c13c54bc9d548178e012f77717f87f2655d'/>
<id>urn:sha1:1ff57c13c54bc9d548178e012f77717f87f2655d</id>
<content type='text'>
Also, convert a constant to GIT_SHA1_HEXSZ.

Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/pretty-empty-format'</title>
<updated>2014-09-02T20:25:04Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-09-02T20:25:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=44ceb79f84b0f339147d2d44e4bb50cc472be03e'/>
<id>urn:sha1:44ceb79f84b0f339147d2d44e4bb50cc472be03e</id>
<content type='text'>
"git log --pretty/format=" with an empty format string did not mean
the more obvious "No output whatsoever" but "Use default format",
which was counterintuitive.

* jk/pretty-empty-format:
  pretty: make empty userformats truly empty
  pretty: treat "--format=" as an empty userformat
  revision: drop useless string offset when parsing "--pretty"
</content>
</entry>
<entry>
<title>Merge branch 'jk/diff-tree-t-fix'</title>
<updated>2014-08-26T18:16:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-08-26T18:16:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4109c28e055dba27d73cefb956bea5e611f66ec0'/>
<id>urn:sha1:4109c28e055dba27d73cefb956bea5e611f66ec0</id>
<content type='text'>
Fix (rarely used) "git diff-tree -t" regression in 2.0.

* jk/diff-tree-t-fix:
  intersect_paths: respect mode in git's tree-sort
</content>
</entry>
<entry>
<title>intersect_paths: respect mode in git's tree-sort</title>
<updated>2014-08-20T20:38:37Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-08-20T02:14:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e09867f0605702c2d4e65b99e178cdaa215a7370'/>
<id>urn:sha1:e09867f0605702c2d4e65b99e178cdaa215a7370</id>
<content type='text'>
When we do a combined diff, we individually diff against
each parent, and then use intersect_paths to do a parallel
walk through the sorted results and come up with a final
list of interesting paths.

The sort order here is that returned by the diffs, which
means it is in git's tree-order which sorts sub-trees as if
their paths have "/" at the end. When we do our parallel
walk, we need to use a comparison function which provides
the same order.

Since 8518ff8 (combine-diff: optimize combine_diff_path sets
intersection, 2014-01-20), we use a simple strcmp to
compare the pathnames, and get this wrong. It's somewhat
hard to trigger because normally a diff does not produce
tree entries at all, and therefore the sort order is the
same as a strcmp. However, if the "-t" option is used with
the diff, then we will produce diff_filepairs for both trees
and files.

We can use base_name_compare to do the comparison, just as
the tree-diff code does. Even though what we have are not
technically base names (they are full paths within the
tree), the end result is the same (we do not care about
interior slashes at all, only about the final character).

However, since we do not have the length of each path
stored, we take a slight shortcut: if neither of the entries
is a sub-tree then the comparison is equivalent to a strcmp.
This lets us skip the extra strlen calls in the common case
without having to reimplement base_name_compare from
scratch.

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>pretty: make empty userformats truly empty</title>
<updated>2014-07-30T19:30:08Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-07-29T17:56:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b9c7d6e4330e3dcdb3b3e5f013e5667e47555c95'/>
<id>urn:sha1:b9c7d6e4330e3dcdb3b3e5f013e5667e47555c95</id>
<content type='text'>
If the user provides an empty format with "--format=", we
end up putting in extra whitespace that the user cannot
prevent. This comes from two places:

  1. If the format is missing a terminating newline, we add
     one automatically. This makes sense for --format=%h, but
     not for a truly empty format.

  2. We add an extra newline between the pretty-printed
     format and a diff or diffstat. If the format is empty,
     there's no point in doing so if there's nothing to
     separate.

With this patch, one can get a diff with no other cruft out
of "diff-tree --format= $commit".

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