<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/git.git/diff.c, branch v1.7.9.3</title>
<subtitle>Git
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v1.7.9.3</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v1.7.9.3'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/'/>
<updated>2012-02-21T23:00:33Z</updated>
<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://git.stealer.net/cgit.cgi/user/sven/git.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://git.stealer.net/cgit.cgi/user/sven/git.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://git.stealer.net/cgit.cgi/user/sven/git.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://git.stealer.net/cgit.cgi/user/sven/git.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://git.stealer.net/cgit.cgi/user/sven/git.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://git.stealer.net/cgit.cgi/user/sven/git.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://git.stealer.net/cgit.cgi/user/sven/git.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://git.stealer.net/cgit.cgi/user/sven/git.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>
<entry>
<title>diff: add option to show whole functions as context</title>
<updated>2011-10-10T19:05:07Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2011-10-09T11:36:57Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=14937c2c06e63f93f65e1bc6693b95d4e54053d7'/>
<id>urn:sha1:14937c2c06e63f93f65e1bc6693b95d4e54053d7</id>
<content type='text'>
Add the option -W/--function-context to git diff.  It is similar to
the same option of git grep and expands the context of change hunks
so that the whole surrounding function is shown.  This "natural"
context can allow changes to be understood better.

Note: GNU patch doesn't like diffs generated with the new option;
it seems to expect context lines to be the same before and after
changes.  git apply doesn't complain.

This implementation has the same shortcoming as the one in grep,
namely that there is no way to explicitly find the end of a
function.  That means that a few lines of extra context are shown,
right up to the next recognized function begins.  It's already
useful in its current form, though.

The function get_func_line() in xdiff/xemit.c is extended to work
forward as well as backward to find post-context as well as
pre-context.  It returns the position of the first found matching
line.  The func_line parameter is made optional, as we don't need
it for -W.

The enhanced function is then used in xdl_emit_diff() to extend
the context as needed.  If the added context overlaps with the
next change, it is merged into the current hunk.

Signed-off-by: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff: resurrect XDF_NEED_MINIMAL with --minimal</title>
<updated>2011-10-03T18:58:18Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-10-02T04:56:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=81b568c839376a10cd5fe29db0b8a72f537fa36a'/>
<id>urn:sha1:81b568c839376a10cd5fe29db0b8a72f537fa36a</id>
<content type='text'>
Earlier, 582aa00 (git diff too slow for a file, 2010-05-02)
unconditionally dropped XDF_NEED_MINIMAL option from the internal xdiff
invocation to help performance on pathological cases, while hinting that a
follow-up patch could reintroduce it with "--minimal" option from the
command line.

Make it so.

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