<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/diff.c, branch v1.7.9.7</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://www.git.shady.money/git/atom?h=v1.7.9.7</id>
<link rel='self' href='https://www.git.shady.money/git/atom?h=v1.7.9.7'/>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/'/>
<updated>2012-03-12T22:46:32Z</updated>
<entry>
<title>Merge branch 'jc/maint-diff-patch-header' into maint</title>
<updated>2012-03-12T22:46:32Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2012-03-12T22:46:32Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=fce8b5d82fadd0bc27b12ae91bf7ad74d6488e97'/>
<id>urn:sha1:fce8b5d82fadd0bc27b12ae91bf7ad74d6488e97</id>
<content type='text'>
"git diff-index" and its friends at the plumbing level showed the
"diff --git" header and nothing else for a path whose cached stat
info is dirty without actual difference when asked to produce a
patch. This was a longstanding bug that we could have fixed long
time ago.

By Junio C Hamano
* jc/maint-diff-patch-header:
  diff -p: squelch "diff --git" header for stat-dirty paths
  t4011: illustrate "diff-index -p" on stat-dirty paths
  t4011: modernise style
</content>
</entry>
<entry>
<title>diff -p: squelch "diff --git" header for stat-dirty paths</title>
<updated>2012-03-01T20:00:01Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2012-03-01T02:14:16Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=b3f01ff29f7131e959bcfdfd004744d74d5fa319'/>
<id>urn:sha1:b3f01ff29f7131e959bcfdfd004744d74d5fa319</id>
<content type='text'>
The plumbing "diff" commands look at the working tree files without
refreshing the index themselves for performance reasons (the calling
script is expected to do that upfront just once, before calling one or
more of them).  In the early days of git, they showed the "diff --git"
header before they actually ask the xdiff machinery to produce patches,
and ended up showing only these headers if the real contents are the same
and the difference they noticed was only because the stat info cached in
the index did not match that of the working tree. It was too late for the
implementation to take the header that it already emitted back.

But 3e97c7c (No diff -b/-w output for all-whitespace changes, 2009-11-19)
introduced necessary logic to keep the meta-information headers in a
strbuf and delay their output until the xdiff machinery noticed actual
changes. This was primarily in order to generate patches that ignore
whitespaces. When operating under "-w" mode, we wouldn't know if the
header is needed until we actually look at the resulting patch, so it was
a sensible thing to do, but we did not realize that the same reasoning
applies to stat-dirty paths.

Later, 296c6bb (diff: fix "git show -C -C" output when renaming a binary
file, 2010-05-26) generalized this machinery and added must_show_header
toggle.  This is turned on when the header must be shown even when there
is no patch to be produced, e.g. only the mode was changed, or the path
was renamed, without changing the contents.  However, when it did so, it
still kept the special case for the "-w" mode, which meant that the
plumbing would keep showing these phantom changes.

This corrects this historical inconsistency by allowing the plumbing to
omit paths that are only stat-dirty from its output in the same way as it
handles whitespace only changes under "-w" option.

The change in the behaviour can be seen in the updated test.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jc/diff-stat-scaler' into maint</title>
<updated>2012-02-21T23:00:33Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2012-02-21T23:00:33Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=a67c23544888761e940452f7533953b3c368456f'/>
<id>urn:sha1:a67c23544888761e940452f7533953b3c368456f</id>
<content type='text'>
* jc/diff-stat-scaler:
  diff --stat: show bars of same length for paths with same amount of changes
</content>
</entry>
<entry>
<title>diff --stat: show bars of same length for paths with same amount of changes</title>
<updated>2012-02-14T22:21:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2012-02-14T21:49:11Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=2eeeef24ff5a6538f41f5fe44f3a4e7f6e36e7e5'/>
<id>urn:sha1:2eeeef24ff5a6538f41f5fe44f3a4e7f6e36e7e5</id>
<content type='text'>
When commit 3ed74e6 (diff --stat: ensure at least one '-' for deletions,
and one '+' for additions, 2006-09-28) improved the output for files with
tiny modifications, we accidentally broke the logic to ensure that two
equal sized changes are shown with the bars of the same length, even when
rounding errors exist.

Compute the length of the graph bars, using the same "non-zero changes is
shown with at least one column" scaling logic, but by scaling the sum of
additions and deletions to come up with the total length of the bar (this
ensures that two equal sized changes result in bars of the same length),
and then scaling the smaller of the additions or deletions. The other side
is computed as the difference between the two.

This makes the apportioning between additions and deletions less accurate
due to rounding errors, but it is much less noticeable than two files with
the same amount of change showing bars of different length.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Use correct grammar in diffstat summary line</title>
<updated>2012-02-04T07:19:42Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2012-02-01T12:55:07Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=7f814632f5d4d7af9f4225ece6039dbc44e03079'/>
<id>urn:sha1:7f814632f5d4d7af9f4225ece6039dbc44e03079</id>
<content type='text'>
"git diff --stat" and "git apply --stat" now learn to print the line
"%d files changed, %d insertions(+), %d deletions(-)" in singular form
whenever applicable. "0 insertions" and "0 deletions" are also omitted
unless they are both zero.

This matches how versions of "diffstat" that are not prehistoric produced
their output, and also makes this line translatable.

[jc: with help from Thomas Dickey in archaeology of "diffstat"]
[jc: squashed Jonathan's updates to illustrations in tutorials and a test]

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'tr/maint-word-diff-incomplete-line'</title>
<updated>2012-01-18T23:16:19Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2012-01-18T23:16:19Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=05c65cb1161f232c65b186d6d6eb3bce9c6a0924'/>
<id>urn:sha1:05c65cb1161f232c65b186d6d6eb3bce9c6a0924</id>
<content type='text'>
* tr/maint-word-diff-incomplete-line:
  word-diff: ignore '\ No newline at eof' marker
</content>
</entry>
<entry>
<title>word-diff: ignore '\ No newline at eof' marker</title>
<updated>2012-01-12T19:27:41Z</updated>
<author>
<name>Thomas Rast</name>
<email>trast@student.ethz.ch</email>
</author>
<published>2012-01-12T11:15:33Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=c7c2bc0ac9e7f077771db53960d4917fda4b27a7'/>
<id>urn:sha1:c7c2bc0ac9e7f077771db53960d4917fda4b27a7</id>
<content type='text'>
The word-diff logic accumulates + and - lines until another line type
appears (normally [ @\]), at which point it generates the word diff.
This is usually correct, but it breaks when the preimage does not have
a newline at EOF:

  $ printf "%s" "a a a" &gt;a
  $ printf "%s\n" "a ab a" &gt;b
  $ git diff --no-index --word-diff a b
  diff --git 1/a 2/b
  index 9f68e94..6a7c02f 100644
  --- 1/a
  +++ 2/b
  @@ -1 +1 @@
  [-a a a-]
   No newline at end of file
  {+a ab a+}

Because of the order of the lines in a unified diff

  @@ -1 +1 @@
  -a a a
  \ No newline at end of file
  +a ab a

the '\' line flushed the buffers, and the - and + lines were never
matched with each other.

A proper fix would defer such markers until the end of the hunk.
However, word-diff is inherently whitespace-ignoring, so as a cheap
fix simply ignore the marker (and hide it from the output).

We use a prefix match for '\ ' to parallel the logic in
apply.c:parse_fragment().  We currently do not localize this string
(just accept other variants of it in git-apply), but this should be
future-proof.

Noticed-by: Ivan Shirokoff &lt;shirokoff@yandex-team.ru&gt;
Signed-off-by: Thomas Rast &lt;trast@student.ethz.ch&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/diff-whole-function'</title>
<updated>2011-10-19T17:49:13Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-10-19T17:49:13Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=9b55aa03daebf43067021b7d58abea249229987b'/>
<id>urn:sha1:9b55aa03daebf43067021b7d58abea249229987b</id>
<content type='text'>
* rs/diff-whole-function:
  diff: add option to show whole functions as context
  xdiff: factor out get_func_line()
</content>
</entry>
<entry>
<title>Merge branch 'rs/diff-cleanup-records-fix'</title>
<updated>2011-10-14T02:03:22Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-10-14T02:03:22Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=7a63a920fd9842f0ccb7a88c8df7652d905fc1ec'/>
<id>urn:sha1:7a63a920fd9842f0ccb7a88c8df7652d905fc1ec</id>
<content type='text'>
* rs/diff-cleanup-records-fix:
  diff: resurrect XDF_NEED_MINIMAL with --minimal
  Revert removal of multi-match discard heuristic in 27af01
</content>
</entry>
<entry>
<title>Merge branch 'jc/maint-diffstat-numstat-context'</title>
<updated>2011-10-10T22:56:18Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-10-10T22:56:18Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=7ddd582402aa926d5ec33d914ccc8bfaf1b15c06'/>
<id>urn:sha1:7ddd582402aa926d5ec33d914ccc8bfaf1b15c06</id>
<content type='text'>
* jc/maint-diffstat-numstat-context:
  diff: teach --stat/--numstat to honor -U$num
</content>
</entry>
</feed>
