<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/range-diff.c, branch v2.23.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.23.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.23.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2019-07-11T21:29:27Z</updated>
<entry>
<title>range-diff: add headers to the outer hunk header</title>
<updated>2019-07-11T21:29:27Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2019-07-11T16:08:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=499352c2adf9c038ec3469d73590b1c55b6a343b'/>
<id>urn:sha1:499352c2adf9c038ec3469d73590b1c55b6a343b</id>
<content type='text'>
Add the section headers/hunk headers we introduced in the previous
commits to the outer diff's hunk headers.  This makes it easier to
understand which change we are actually looking at.  For example an
outer hunk header might now look like:

    @@  Documentation/config/interactive.txt

while previously it would have only been

    @@

which doesn't give a lot of context for the change that follows.

For completeness also add section headers for the commit metadata and
the commit message, although they are arguably less important.

Signed-off-by: Thomas Gummerer &lt;t.gummerer@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>range-diff: add filename to inner diff</title>
<updated>2019-07-11T21:29:27Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2019-07-11T16:08:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=444e0969baaf2f68691ac7b49d5413d5e0d8d1fb'/>
<id>urn:sha1:444e0969baaf2f68691ac7b49d5413d5e0d8d1fb</id>
<content type='text'>
In a range-diff it's not always clear which file a certain funcname of
the inner diff belongs to, because the diff header (or section header
as added in a previous commit) is not always visible in the
range-diff.

Add the filename to the inner diffs header, so it's always visible to
users.

This also allows us to add the filename + the funcname to the outer
diffs hunk headers using a custom userdiff pattern, which will be done
in the next commit.

Signed-off-by: Thomas Gummerer &lt;t.gummerer@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>range-diff: add section header instead of diff header</title>
<updated>2019-07-11T21:29:27Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2019-07-11T16:08:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b66885a30cb84fc61986bc4eea805a31fdbea79a'/>
<id>urn:sha1:b66885a30cb84fc61986bc4eea805a31fdbea79a</id>
<content type='text'>
Currently range-diff keeps the diff header of the inner diff
intact (apart from stripping lines starting with index).  This diff
header is somewhat useful, especially when files get different
names in different ranges.

However there is no real need to keep the whole diff header for that.
The main reason we currently do that is probably because it is easy to
do.

Introduce a new range diff hunk header, that's enclosed by "##",
similar to how line numbers in diff hunks are enclosed by "@@", and
give human readable information of what exactly happened to the file,
including the file name.

This improves the readability of the range-diff by giving more concise
information to the users.  For example if a file was renamed in one
iteration, but not in another, the diff of the headers would be quite
noisy.  However the diff of a single line is concise and should be
easier to understand.

Additionally, this allows us to add these range diff section headers to
the outer diffs hunk headers using a custom userdiff pattern, which
should help making the range-diff more readable.

Signed-off-by: Thomas Gummerer &lt;t.gummerer@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>range-diff: suppress line count in outer diff</title>
<updated>2019-07-11T21:29:27Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2019-07-11T16:08:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=430be36eb53b042c447201c778b5398df887022f'/>
<id>urn:sha1:430be36eb53b042c447201c778b5398df887022f</id>
<content type='text'>
The line count in the outer diff's hunk headers of a range diff is not
all that interesting.  It merely shows how far along the inner diff
are on both sides.  That number is of no use for human readers, and
range-diffs are not meant to be machine readable.

In a subsequent commit we're going to add some more contextual
information such as the filename corresponding to the diff to the hunk
headers.  Remove the unnecessary information, and just keep the "@@"
to indicate that a new hunk of the outer diff is starting.

Signed-off-by: Thomas Gummerer &lt;t.gummerer@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>range-diff: don't remove funcname from inner diff</title>
<updated>2019-07-11T21:29:27Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2019-07-11T16:08:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e1db26308413f5da2cef2c9c3869257d1ed6336b'/>
<id>urn:sha1:e1db26308413f5da2cef2c9c3869257d1ed6336b</id>
<content type='text'>
When postprocessing the inner diff in range-diff, we currently replace
the whole hunk header line with just "@@".  This matches how 'git
tbdiff' used to handle hunk headers as well.

Most likely this is being done because line numbers in the hunk header
are not relevant without other changes.  They can for example easily
change if a range is rebased, and lines are added/removed before a
change that we actually care about in our ranges.

However it can still be useful to have the function name that 'git
diff' extracts as additional context for the change.

Note that it is not guaranteed that the hunk header actually shows up
in the range-diff, and this change only aims to improve the case where
a hunk header would already be included in the final output.

Signed-off-by: Thomas Gummerer &lt;t.gummerer@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>range-diff: split lines manually</title>
<updated>2019-07-11T21:29:27Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2019-07-11T16:08:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=44b67cb62b339fdc6239ef6b72b8c75b559a574a'/>
<id>urn:sha1:44b67cb62b339fdc6239ef6b72b8c75b559a574a</id>
<content type='text'>
Currently range-diff uses the 'strbuf_getline()' function for doing
its line by line processing.  In a future patch we want to do parts of
that parsing using the 'parse_git_diff_header()' function.  That
function does its own line by line reading of the input, and doesn't
use strbufs.  This doesn't match with how we do the line-by-line
processing in range-diff currently.

Switch range-diff to do our own line by line parsing, so we can re-use
the 'parse_git_diff_header()' function later.

Signed-off-by: Thomas Gummerer &lt;t.gummerer@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>range-diff: fix function parameter indentation</title>
<updated>2019-07-11T21:29:27Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2019-07-11T16:08:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1ca69225981a915b0041f74047fe554b1580da5b'/>
<id>urn:sha1:1ca69225981a915b0041f74047fe554b1580da5b</id>
<content type='text'>
Fix the indentation of the function parameters for a couple of
functions, to match the style in the rest of the file.

Signed-off-by: Thomas Gummerer &lt;t.gummerer@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>format-patch: do not let its diff-options affect --range-diff</title>
<updated>2018-11-30T04:47:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-11-30T04:27:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d8981c3f885ceaddfec0e545b0f995b96e5ec58f'/>
<id>urn:sha1:d8981c3f885ceaddfec0e545b0f995b96e5ec58f</id>
<content type='text'>
Stop leaking how the primary output of format-patch is customized to
the range-diff machinery and instead let the latter use its own
"reasonable default", in order to correct the breakage introduced by
a5170794 ("Merge branch 'ab/range-diff-no-patch'", 2018-11-18) on
the 'master' front.  "git format-patch --range-diff..." without any
weird diff option started to include the "range-diff --stat" output,
which is rather useless right now, that made the whole thing
unusable and this is probably the least disruptive way to whip the
codebase into a shippable shape.

We may want to later make the range-diff driven by format-patch more
configurable, but that would have to wait until we have a good
design.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ab/range-diff-no-patch'</title>
<updated>2018-11-18T09:23:54Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-11-18T09:23:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a5170794372cf1325710a3419473c91ec4af53bf'/>
<id>urn:sha1:a5170794372cf1325710a3419473c91ec4af53bf</id>
<content type='text'>
The "--no-patch" option, which can be used to get a high-level
overview without the actual line-by-line patch difference shown, of
the "range-diff" command was earlier broken, which has been
corrected.

* ab/range-diff-no-patch:
  range-diff: make diff option behavior (e.g. --stat) consistent
  range-diff: fix regression in passing along diff options
  range-diff doc: add a section about output stability
</content>
</entry>
<entry>
<title>range-diff: make diff option behavior (e.g. --stat) consistent</title>
<updated>2018-11-14T06:25:48Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2018-11-13T18:55:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a48e12ef7a9498084dc510765452bc3b8677683f'/>
<id>urn:sha1:a48e12ef7a9498084dc510765452bc3b8677683f</id>
<content type='text'>
Make the behavior when diff options (e.g. "--stat") are passed
consistent with how "diff" behaves.

Before 73a834e9e2 ("range-diff: relieve callers of low-level
configuration burden", 2018-07-22) running range-diff with "--stat"
would produce stat output and the diff output, as opposed to how
"diff" behaves where once "--stat" is specified "--patch" also needs
to be provided to emit the patch output.

As noted in a previous change ("range-diff doc: add a section about
output stability", 2018-11-07) the "--stat" output with "range-diff"
is useless at the moment.

But we should behave consistently with "diff" in anticipation of such
output being useful in the future, because it would make for confusing
UI if "diff" and "range-diff" behaved differently when it came to how
they interpret diff options.

The new behavior is also consistent with the existing documentation
added in ba931edd28 ("range-diff: populate the man page",
2018-08-13). See "[...]also accepts the regular diff options[...]" in
git-range-diff(1).

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
