<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/diff.h, branch v2.40.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.40.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.40.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2023-02-27T18:08:56Z</updated>
<entry>
<title>Merge branch 'jc/diff-algo-attribute'</title>
<updated>2023-02-27T18:08:56Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-02-27T18:08:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ece8dc97ae53d08247aa283b6f299e3e5b2669db'/>
<id>urn:sha1:ece8dc97ae53d08247aa283b6f299e3e5b2669db</id>
<content type='text'>
The "diff" drivers specified by the "diff" attribute attached to
paths can now specify which algorithm (e.g. histogram) to use.

* jc/diff-algo-attribute:
  diff: teach diff to read algorithm from diff driver
  diff: consolidate diff algorithm option parsing
</content>
</entry>
<entry>
<title>diff: teach diff to read algorithm from diff driver</title>
<updated>2023-02-21T17:29:10Z</updated>
<author>
<name>John Cai</name>
<email>johncai86@gmail.com</email>
</author>
<published>2023-02-20T21:04:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a4cf900ee734ce9bb73d57c5dfbb1da4a5a88bd3'/>
<id>urn:sha1:a4cf900ee734ce9bb73d57c5dfbb1da4a5a88bd3</id>
<content type='text'>
It can be useful to specify diff algorithms per file type. For example,
one may want to use the minimal diff algorithm for .json files, another
for .c files, etc.

The diff machinery already checks attributes for a diff driver. Teach
the diff driver parser a new type "algorithm" to look for in the
config, which will be used if a driver has been specified through the
attributes.

Enforce precedence of the diff algorithm by favoring the command line
option, then looking at the driver attributes &amp; config combination, then
finally the diff.algorithm config.

To enforce precedence order, use a new `ignore_driver_algorithm` member
during options parsing to indicate the diff algorithm was set via command
line args.

Signed-off-by: John Cai &lt;johncai86@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/diff-parseopts'</title>
<updated>2022-12-19T02:46:17Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-12-19T02:46:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ab91f6b7c42531406bcca0e48c48530126332142'/>
<id>urn:sha1:ab91f6b7c42531406bcca0e48c48530126332142</id>
<content type='text'>
The way the diff machinery prepares the options array for the
parse_options API has been refactored to avoid resource leaks.

* rs/diff-parseopts:
  diff: remove parseopts member from struct diff_options
  diff: use add_diff_options() in diff_opt_parse()
  diff: factor out add_diff_options()
</content>
</entry>
<entry>
<title>diff: remove parseopts member from struct diff_options</title>
<updated>2022-12-01T23:25:30Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2022-12-01T22:53:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=189e97bc4ba8d5f2ab4746d41204feed159fbe9a'/>
<id>urn:sha1:189e97bc4ba8d5f2ab4746d41204feed159fbe9a</id>
<content type='text'>
repo_diff_setup() builds the struct option array with git diff's command
line options and stores a pointer to it in the parseopts member of
struct diff_options.  The array is freed by diff_setup_done(), but not
by release_revisions().  Thus calling only repo_diff_setup() and
release_revisions() leaks that array.

We could free it in release_revisions() as well to plug that leak, but
there is a better way: Only build it when needed.  Absorb
prep_parse_options() into the last place that uses the parseopts member
of struct diff_options, add_diff_parseopts(), and get rid of said
member.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff: factor out add_diff_options()</title>
<updated>2022-12-01T23:25:29Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2022-12-01T22:49:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c5630c4868c74aab2fc4e8a4ef4bfc9c51534e0e'/>
<id>urn:sha1:c5630c4868c74aab2fc4e8a4ef4bfc9c51534e0e</id>
<content type='text'>
Add a function for appending the parseopts member of struct diff_options
to a struct option array.  Use it in two sites instead of accessing the
parseopts member directly.  Decoupling callers from diff internals like
that allows us to change the latter.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>patch-id: use stable patch-id for rebases</title>
<updated>2022-10-24T22:44:19Z</updated>
<author>
<name>Jerry Zhang</name>
<email>jerry@skydio.com</email>
</author>
<published>2022-10-24T20:07:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=51276c1832d64d3b8f4dfc06c3ef21bf74f1916e'/>
<id>urn:sha1:51276c1832d64d3b8f4dfc06c3ef21bf74f1916e</id>
<content type='text'>
Git doesn't persist patch-ids during the rebase process, so there is
no need to specifically invoke the unstable variant. Use the stable
logic for all internal patch-id calculations to minimize the number of
code paths and improve test coverage.

Signed-off-by: Jerry Zhang &lt;jerry@skydio.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'js/diff-filter-negation-fix'</title>
<updated>2022-02-16T23:14:30Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-02-16T23:14:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9a160990ef3a16fab8d54752d0d9b981d15b00c5'/>
<id>urn:sha1:9a160990ef3a16fab8d54752d0d9b981d15b00c5</id>
<content type='text'>
"git diff --diff-filter=aR" is now parsed correctly.

* js/diff-filter-negation-fix:
  diff-filter: be more careful when looking for negative bits
  diff.c: move the diff filter bits definitions up a bit
  docs(diff): lose incorrect claim about `diff-files --diff-filter=A`
</content>
</entry>
<entry>
<title>diff: add ability to insert additional headers for paths</title>
<updated>2022-02-02T18:02:28Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2022-02-02T02:37:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=95433eeed9eac439eb21eb30105354b15e71302e'/>
<id>urn:sha1:95433eeed9eac439eb21eb30105354b15e71302e</id>
<content type='text'>
When additional headers are provided, we need to
  * add diff_filepairs to diff_queued_diff for each paths in the
    additional headers map which, unless that path is part of
    another diff_filepair already found in diff_queued_diff
  * format the headers (colorization, line_prefix for --graph)
  * make sure the various codepaths that attempt to return early
    if there are "no changes" take into account the headers that
    need to be shown.

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff-filter: be more careful when looking for negative bits</title>
<updated>2022-01-28T18:18:18Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2022-01-28T12:02:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=75408ca94980c125b3a800003c3e6b7cdcb27d44'/>
<id>urn:sha1:75408ca94980c125b3a800003c3e6b7cdcb27d44</id>
<content type='text'>
The `--diff-filter=&lt;bits&gt;` option allows to filter the diff by certain
criteria, for example `R` to only show renamed files. It also supports
negating a filter via a down-cased letter, i.e. `r` to show _everything
but_ renamed files.

However, the code is a bit overzealous when trying to figure out whether
`git diff` should start with all diff-filters turned on because the user
provided a lower-case letter: if the `--diff-filter` argument starts
with an upper-case letter, we must not start with all bits turned on.

Even worse, it is possible to specify the diff filters in multiple,
separate options, e.g. `--diff-filter=AM [...] --diff-filter=m`.

Let's accumulate the include/exclude filters independently, and only
special-case the "only exclude filters were specified" case after
parsing the options altogether.

Note: The code replaced by this commit took pains to avoid setting any
unused bits of `options-&gt;filter`. That was unnecessary, though, as all
accesses happen via the `filter_bit_tst()` function using specific bits,
and setting the unused bits has no effect. Therefore, we can simplify
the code by using `~0` (or in this instance, `~&lt;unwanted-bit&gt;`).

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff.h: move pickaxe fields together again</title>
<updated>2021-05-11T03:47:31Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-04-12T17:15:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a47fcbe6e412df295f1f5ffb8eca6dbe86d2b7bb'/>
<id>urn:sha1:a47fcbe6e412df295f1f5ffb8eca6dbe86d2b7bb</id>
<content type='text'>
Move the pickaxe and pickaxe_opts fields next to each other again. In
a past life they'd been on adjacent lines, but when they got moved
from a global variable to the diff_options struct in 6b5ee137e5 (Diff
clean-up., 2005-09-21) they got split apart.

That split made sense at the time, the "char*" and "int" (flags)
options were being grouped, but we've long since abandoned that
pattern in the diff_options struct, and now it makes more sense to
group these together again.

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>
