<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/diff.c, branch v2.12.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://www.git.shady.money/git/atom?h=v2.12.0</id>
<link rel='self' href='https://www.git.shady.money/git/atom?h=v2.12.0'/>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/'/>
<updated>2017-02-15T20:54:19Z</updated>
<entry>
<title>Merge branch 'rs/swap'</title>
<updated>2017-02-15T20:54:19Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-02-15T20:54:19Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=cbf1860d73b782e7924e63361df485b31225a26a'/>
<id>urn:sha1:cbf1860d73b782e7924e63361df485b31225a26a</id>
<content type='text'>
Code clean-up.

* rs/swap:
  graph: use SWAP macro
  diff: use SWAP macro
  use SWAP macro
  apply: use SWAP macro
  add SWAP macro
</content>
</entry>
<entry>
<title>Merge branch 'jk/log-graph-name-only'</title>
<updated>2017-02-10T20:52:27Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-02-10T20:52:26Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=e53c7f8731f7fa66864397d3d1ec1ad7c035c23a'/>
<id>urn:sha1:e53c7f8731f7fa66864397d3d1ec1ad7c035c23a</id>
<content type='text'>
"git log --graph" did not work well with "--name-only", even though
other forms of "diff" output were handled correctly.

* jk/log-graph-name-only:
  diff: print line prefix for --name-only output
</content>
</entry>
<entry>
<title>diff: print line prefix for --name-only output</title>
<updated>2017-02-08T21:39:57Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2017-02-08T20:31:15Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=f5022b5fedb405c6bbb0b3e7c5a3a7f507279ef5'/>
<id>urn:sha1:f5022b5fedb405c6bbb0b3e7c5a3a7f507279ef5</id>
<content type='text'>
If you run "git log --graph --name-only", the pathnames are
not indented to go along with their matching commits (unlike
all of the other diff formats). We need to output the line
prefix for each item before writing it.

The tests cover both --name-status and --name-only. The
former actually gets this right already, because it builds
on the --raw format functions. It's only --name-only which
uses its own code (and this fix mirrors the code in
diff_flush_raw()).

Note that the tests don't follow our usual style of setting
up the "expect" output inside the test block. This matches
the surrounding style, but more importantly it is easier to
read: we don't have to worry about embedded single-quotes,
and the leading indentation is more obvious.

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>use oid_to_hex_r() for converting struct object_id hashes to hex strings</title>
<updated>2017-01-30T22:23:40Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-01-28T22:03:03Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=2490574d15cab6e8d955dc4132cf9e7e83fc1172'/>
<id>urn:sha1:2490574d15cab6e8d955dc4132cf9e7e83fc1172</id>
<content type='text'>
Patch generated by Coccinelle and contrib/coccinelle/object_id.cocci.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff: use SWAP macro</title>
<updated>2017-01-30T22:23:00Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-01-28T21:41:47Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=402bf8e19832142de97d84d37c51262d91e5f2db'/>
<id>urn:sha1:402bf8e19832142de97d84d37c51262d91e5f2db</id>
<content type='text'>
Use the macro SWAP to exchange the value of pairs of variables instead
of swapping them manually with the help of a temporary variable.  The
resulting code is shorter and easier to read.

The two cases were not transformed by the semantic patch swap.cocci
because it's extra careful and handles only cases where the types of all
variables are the same -- and here we swap two ints and use an unsigned
temporary variable for that.  Nevertheless the conversion is safe, as
the value range is preserved with and without the patch.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>use SWAP macro</title>
<updated>2017-01-30T22:17:00Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-01-28T21:40:58Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=35d803bc9a0d21c36b1381f6e42455beeb73b715'/>
<id>urn:sha1:35d803bc9a0d21c36b1381f6e42455beeb73b715</id>
<content type='text'>
Apply the semantic patch swap.cocci to convert hand-rolled swaps to use
the macro SWAP.  The resulting code is shorter and easier to read, the
object code is effectively unchanged.

The patch for object.c had to be hand-edited in order to preserve the
comment before the change; Coccinelle tried to eat it for some reason.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff: add interhunk context config option</title>
<updated>2017-01-12T20:55:43Z</updated>
<author>
<name>Vegard Nossum</name>
<email>vegard.nossum@oracle.com</email>
</author>
<published>2017-01-12T12:21:11Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=c488867793dc9b273c1d35746452d44afcd3d7f5'/>
<id>urn:sha1:c488867793dc9b273c1d35746452d44afcd3d7f5</id>
<content type='text'>
The --inter-hunk-context= option was added in commit 6d0e674a5754
("diff: add option to show context between close hunks"). This patch
allows configuring a default for this option.

Signed-off-by: Vegard Nossum &lt;vegard.nossum@oracle.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jc/retire-compaction-heuristics'</title>
<updated>2017-01-10T23:24:27Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-01-10T23:24:27Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=2ced5f2c2ddcfe3a45d75ae1d552c11cad70236d'/>
<id>urn:sha1:2ced5f2c2ddcfe3a45d75ae1d552c11cad70236d</id>
<content type='text'>
"git diff" and its family had two experimental heuristics to shift
the contents of a hunk to make the patch easier to read.  One of
them turns out to be better than the other, so leave only the
"--indent-heuristic" option and remove the other one.

* jc/retire-compaction-heuristics:
  diff: retire "compaction" heuristics
</content>
</entry>
<entry>
<title>diff: retire "compaction" heuristics</title>
<updated>2016-12-23T20:32:22Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-12-23T20:32:22Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=3cde4e02ee891bff53bac7f6a7d977f50418a4b5'/>
<id>urn:sha1:3cde4e02ee891bff53bac7f6a7d977f50418a4b5</id>
<content type='text'>
When a patch inserts a block of lines, whose last lines are the
same as the existing lines that appear before the inserted block,
"git diff" can choose any place between these existing lines as the
boundary between the pre-context and the added lines (adjusting the
end of the inserted block as appropriate) to come up with variants
of the same patch, and some variants are easier to read than others.

We have been trying to improve the choice of this boundary, and Git
2.11 shipped with an experimental "compaction-heuristic".  Since
then another attempt to improve the logic further resulted in a new
"indent-heuristic" logic.  It is agreed that the latter gives better
result overall, and the former outlived its usefulness.

Retire "compaction", and keep "indent" as an experimental feature.
The latter hopefully will be turned on by default in a future
release, but that should be done as a separate step.

Suggested-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff: handle --no-abbrev in no-index case</title>
<updated>2016-12-08T22:40:30Z</updated>
<author>
<name>Jack Bates</name>
<email>bk874k@nottheoilrig.com</email>
</author>
<published>2016-12-06T16:56:14Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=43d1948b7b84abc744227259dd1a3e8dfbb60358'/>
<id>urn:sha1:43d1948b7b84abc744227259dd1a3e8dfbb60358</id>
<content type='text'>
There are two different places where the --no-abbrev option is parsed,
and two different places where SHA-1s are abbreviated. We normally parse
--no-abbrev with setup_revisions(), but in the no-index case, "git diff"
calls diff_opt_parse() directly, and diff_opt_parse() didn't handle
--no-abbrev until now. (It did handle --abbrev, however.) We normally
abbreviate SHA-1s with find_unique_abbrev(), but commit 4f03666 ("diff:
handle sha1 abbreviations outside of repository, 2016-10-20) recently
introduced a special case when you run "git diff" outside of a
repository.

setup_revisions() does also call diff_opt_parse(), but not for --abbrev
or --no-abbrev, which it handles itself. setup_revisions() sets
rev_info-&gt;abbrev, and later copies that to diff_options-&gt;abbrev. It
handles --no-abbrev by setting abbrev to zero. (This change doesn't
touch that.)

Setting abbrev to zero was broken in the outside-of-a-repository special
case, which until now resulted in a truly zero-length SHA-1, rather than
taking zero to mean do not abbreviate. The only way to trigger this bug,
however, was by running "git diff --raw" without either the --abbrev or
--no-abbrev options, because 1) without --raw it doesn't respect abbrev
(which is bizarre, but has been that way forever), 2) we silently clamp
--abbrev=0 to MINIMUM_ABBREV, and 3) --no-abbrev wasn't handled until
now.

The outside-of-a-repository case is one of three no-index cases. The
other two are when one of the files you're comparing is outside of the
repository you're in, and the --no-index option.

Signed-off-by: Jack Bates &lt;jack@nottheoilrig.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
