<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/diff.h, branch v2.35.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.35.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.35.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2021-05-11T03:47:31Z</updated>
<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>
<entry>
<title>pickaxe: die when --find-object and --pickaxe-all are combined</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:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d26ec8800969ea1b692e0c87100dc4235cfa12e2'/>
<id>urn:sha1:d26ec8800969ea1b692e0c87100dc4235cfa12e2</id>
<content type='text'>
Neither the --pickaxe-all documentation nor --find-object's has ever
suggested that you can combine the two. See f506b8e8b5 (git log/diff:
add -G&lt;regexp&gt; that greps in the patch text, 2010-08-23) and
15af58c1ad (diffcore: add a pickaxe option to find a specific blob,
2018-01-04).

But we've silently tolerated it, which makes the logic in
diffcore_pickaxe() harder to reason about. Let's assert that we won't
have the two combined.

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>
<entry>
<title>pickaxe: die when -G and --pickaxe-regex are combined</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:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=188e9e28c5287f3f160b5f14e3e551b1c55c7301'/>
<id>urn:sha1:188e9e28c5287f3f160b5f14e3e551b1c55c7301</id>
<content type='text'>
When the -G and --pickaxe-regex options are combined we simply ignore
the --pickaxe-regex option. Let's die instead as suggested by our
documentation, since -G is always a regex.

When --pickaxe-regex was added in d01d8c6782 (Support for pickaxe
matching regular expressions, 2006-03-29) only the -S option
existed. Then when -G was added in f506b8e8b5 (git log/diff: add
-G&lt;regexp&gt; that greps in the patch text, 2010-08-23) neither the
documentation for --pickaxe-regex was updated accordingly, nor was
something like this assertion added.

Since 5bc3f0b567 (diffcore-pickaxe doc: document -S and -G properly,
2013-05-31) we've claimed that --pickaxe-regex should only be used
with -S, but have silently tolerated combining it with -G, let's die
instead.

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>
<entry>
<title>Merge branch 'jc/diffcore-rotate'</title>
<updated>2021-02-26T00:43:30Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-02-26T00:43:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=845d6030f81da3bb43bd24a78ef8c441a441c5d5'/>
<id>urn:sha1:845d6030f81da3bb43bd24a78ef8c441a441c5d5</id>
<content type='text'>
"git {diff,log} --{skip,rotate}-to=&lt;path&gt;" allows the user to
discard diff output for early paths or move them to the end of the
output.

* jc/diffcore-rotate:
  diff: --{rotate,skip}-to=&lt;path&gt;
</content>
</entry>
<entry>
<title>diff: --{rotate,skip}-to=&lt;path&gt;</title>
<updated>2021-02-16T17:30:42Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-02-11T19:57:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1eb4136ac2a24764257567b930535fcece01719f'/>
<id>urn:sha1:1eb4136ac2a24764257567b930535fcece01719f</id>
<content type='text'>
In the implementation of "git difftool", there is a case where the
user wants to start viewing the diffs at a specific path and
continue on to the rest, optionally wrapping around to the
beginning.  Since it is somewhat cumbersome to implement such a
feature as a post-processing step of "git diff" output, let's
support it internally with two new options.

 - "git diff --rotate-to=C", when the resulting patch would show
   paths A B C D E without the option, would "rotate" the paths to
   shows patch to C D E A B instead.  It is an error when there is
   no patch for C is shown.

 - "git diff --skip-to=C" would instead "skip" the paths before C,
   and shows patch to C D E.  Again, it is an error when there is no
   patch for C is shown.

 - "git log [-p]" also accepts these two options, but it is not an
   error if there is no change to the specified path.  Instead, the
   set of output paths are rotated or skipped to the specified path
   or the first path that sorts after the specified path.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff: add an API for deferred freeing</title>
<updated>2021-02-11T17:21:05Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-02-11T10:45:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e900d494dcff7bb9033865e61b452128ff232481'/>
<id>urn:sha1:e900d494dcff7bb9033865e61b452128ff232481</id>
<content type='text'>
Add a diff_free() function to free anything we may have allocated in
the "diff_options" struct, and the ability to make calling it a noop
by setting "no_free" in "diff_options".

This is required because when e.g. "git diff" is run we'll allocate
things in that struct, use the diff machinery once, and then exit.

But if we run e.g. "git log -p" we're going to re-use what we
allocated across multiple diff_flush() calls, and only want to free
things at the end.

We've thus ended up with features like the recently added "diff -I"[1]
where we'll leak memory. As it turns out it could have simply used the
pattern established in 6ea57703f6 (log: prepare log/log-tree to reuse
the diffopt.close_file attribute, 2016-06-22).

Manually adding more such flags to things log_tree_commit() every time
we need to allocate something would be tedious. Let's instead move
that fclose() code it to a new diff_free(), in anticipation of freeing
more things in that function in follow-up commits.

Some functions such as log_tree_commit() need an idiom of optionally
retaining a previous "no_free", as they may either free the memory
themselves, or their caller may do so. I'm keeping that idiom in
log_show_early() for good measure, even though I don't think it's
currently called in this manner. It also gets passed an existing
"struct rev_info", so future callers may want to set the "no_free"
flag.

This change is a bit hard to read because while the freeing pattern
we're introducing isn't unusual, the "file" member is a special
snowflake. We usually don't want to fclose() it. This is because
"file" is usually stdout, in which case we don't want to fclose()
it. We only want to opt-in to closing it when we e.g. open a file on
the filesystem. Thus the opt-in "close_file" flag.

So the API in general just needs a "no_free" flag to defer freeing,
but the "file" member still needs its "close_file" flag. This is made
more confusing because while refactoring this code we could replace
some "close_file=0" with "no_free=1", whereas others need to set both
flags.

This is because there were some cases where an existing "close_file=0"
meant "let's defer deallocation", and others where it meant "we don't
want to close this file handle at all".

1. 296d4a94e7 (diff: add -I&lt;regex&gt; that ignores matching changes,
   2020-10-20)

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>
<entry>
<title>Merge branch 'sj/untracked-files-in-submodule-directory-is-not-dirty'</title>
<updated>2021-01-25T22:19:18Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-01-25T22:19:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=080627942802e767b068a491f3d349227f4e2cdc'/>
<id>urn:sha1:080627942802e767b068a491f3d349227f4e2cdc</id>
<content type='text'>
"git diff" showed a submodule working tree with untracked cruft as
"Submodule commit &lt;objectname&gt;-dirty", but a natural expectation is
that the "-dirty" indicator would align with "git describe --dirty",
which does not consider having untracked files in the working tree
as source of dirtiness.  The inconsistency has been fixed.

* sj/untracked-files-in-submodule-directory-is-not-dirty:
  diff: do not show submodule with untracked files as "-dirty"
</content>
</entry>
<entry>
<title>diff: do not show submodule with untracked files as "-dirty"</title>
<updated>2020-12-08T22:27:35Z</updated>
<author>
<name>Sangeeta Jain</name>
<email>sangunb09@gmail.com</email>
</author>
<published>2020-11-10T08:39:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8ef93124645f89c45c9ec3edd3b268b38154061a'/>
<id>urn:sha1:8ef93124645f89c45c9ec3edd3b268b38154061a</id>
<content type='text'>
Git diff reports a submodule directory as -dirty even when there are
only untracked files in the submodule directory. This is inconsistent
with what `git describe --dirty` says when run in the submodule
directory in that state.

Make `--ignore-submodules=untracked` the default for `git diff` when
there is no configuration variable or command line option, so that the
command would not give '-dirty' suffix to a submodule whose working
tree has untracked files, to make it consistent with `git
describe --dirty` that is run in the submodule working tree.

And also make `--ignore-submodules=none` the default for `git status`
so that the user doesn't end up deleting a submodule that has
uncommitted (untracked) files.

Signed-off-by: Sangeeta Jain &lt;sangunb09@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'mk/diff-ignore-regex'</title>
<updated>2020-11-02T21:17:44Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-11-02T21:17:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1ae0949a036864de1f5caa7b375b875284d1c69e'/>
<id>urn:sha1:1ae0949a036864de1f5caa7b375b875284d1c69e</id>
<content type='text'>
"git diff" family of commands learned the "-I&lt;regex&gt;" option to
ignore hunks whose changed lines all match the given pattern.

* mk/diff-ignore-regex:
  diff: add -I&lt;regex&gt; that ignores matching changes
  merge-base, xdiff: zero out xpparam_t structures
</content>
</entry>
<entry>
<title>Merge branch 'dl/diff-merge-base'</title>
<updated>2020-11-02T21:17:39Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-11-02T21:17:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b6fb70c985a6fc113e971a6696f328abf8315dce'/>
<id>urn:sha1:b6fb70c985a6fc113e971a6696f328abf8315dce</id>
<content type='text'>
"git diff A...B" learned "git diff --merge-base A B", which is a
longer short-hand to say the same thing.

* dl/diff-merge-base:
  contrib/completion: complete `git diff --merge-base`
  builtin/diff-tree: learn --merge-base
  builtin/diff-index: learn --merge-base
  t4068: add --merge-base tests
  diff-lib: define diff_get_merge_base()
  diff-lib: accept option flags in run_diff_index()
  contrib/completion: extract common diff/difftool options
  git-diff.txt: backtick quote command text
  git-diff-index.txt: make --cached description a proper sentence
  t4068: remove unnecessary &gt;tmp
</content>
</entry>
</feed>
