<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/diff-lib.c, branch v2.44.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.44.3</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.44.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2024-01-08T22:05:15Z</updated>
<entry>
<title>Merge branch 'en/header-cleanup'</title>
<updated>2024-01-08T22:05:15Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-01-08T22:05:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=492ee03f60297e7e83d101f4519ab8abc98782bc'/>
<id>urn:sha1:492ee03f60297e7e83d101f4519ab8abc98782bc</id>
<content type='text'>
Remove unused header "#include".

* en/header-cleanup:
  treewide: remove unnecessary includes in source files
  treewide: add direct includes currently only pulled in transitively
  trace2/tr2_tls.h: remove unnecessary include
  submodule-config.h: remove unnecessary include
  pkt-line.h: remove unnecessary include
  line-log.h: remove unnecessary include
  http.h: remove unnecessary include
  fsmonitor--daemon.h: remove unnecessary includes
  blame.h: remove unnecessary includes
  archive.h: remove unnecessary include
  treewide: remove unnecessary includes in source files
  treewide: remove unnecessary includes from header files
</content>
</entry>
<entry>
<title>Merge branch 'jc/diff-cached-fsmonitor-fix'</title>
<updated>2023-12-27T22:52:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-12-27T22:52:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b7fbd2ab83a9c1152eb887ec49c02a71190058ec'/>
<id>urn:sha1:b7fbd2ab83a9c1152eb887ec49c02a71190058ec</id>
<content type='text'>
The optimization based on fsmonitor in the "diff --cached"
codepath is resurrected with the "fake-lstat" introduced earlier.

* jc/diff-cached-fsmonitor-fix:
  diff-lib: fix check_removed() when fsmonitor is active
</content>
</entry>
<entry>
<title>treewide: remove unnecessary includes in source files</title>
<updated>2023-12-26T20:04:31Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2023-12-23T17:14:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=eea0e59ffbed6e33d171ace5be13cde9faa41639'/>
<id>urn:sha1:eea0e59ffbed6e33d171ace5be13cde9faa41639</id>
<content type='text'>
Each of these were checked with
   gcc -E -I. ${SOURCE_FILE} | grep ${HEADER_FILE}
to ensure that removing the direct inclusion of the header actually
resulted in that header no longer being included at all (i.e. that
no other header pulled it in transitively).

...except for a few cases where we verified that although the header
was brought in transitively, nothing from it was directly used in
that source file.  These cases were:
  * builtin/credential-cache.c
  * builtin/pull.c
  * builtin/send-pack.c

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>Merge branch 'ar/diff-index-merge-base-fix'</title>
<updated>2023-10-13T21:18:28Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-10-13T21:18:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=09dcbb486d964b59222136dd1668023098658eda'/>
<id>urn:sha1:09dcbb486d964b59222136dd1668023098658eda</id>
<content type='text'>
"git diff --merge-base X other args..." insisted that X must be a
commit and errored out when given an annotated tag that peels to a
commit, but we only need it to be a committish.  This has been
corrected.

* ar/diff-index-merge-base-fix:
  diff: fix --merge-base with annotated tags
</content>
</entry>
<entry>
<title>diff: fix --merge-base with annotated tags</title>
<updated>2023-10-02T18:55:42Z</updated>
<author>
<name>Alyssa Ross</name>
<email>hi@alyssa.is</email>
</author>
<published>2023-10-01T15:18:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4adceb5a299164aad1ef9794cdcbdb232ab10299'/>
<id>urn:sha1:4adceb5a299164aad1ef9794cdcbdb232ab10299</id>
<content type='text'>
Checking early for OBJ_COMMIT excludes other objects that can be
resolved to commits, like annotated tags.  If we remove it, annotated
tags will be resolved and handled just fine by
lookup_commit_reference(), and if we are given something that can't be
resolved to a commit, we'll still get a useful error message, e.g.:

&gt; error: object 21ab162211ac3ef13c37603ca88b27e9c7e0d40b is a tree, not a commit
&gt; fatal: no merge base found

Signed-off-by: Alyssa Ross &lt;hi@alyssa.is&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'js/diff-cached-fsmonitor-fix'</title>
<updated>2023-09-20T17:44:57Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-09-20T17:44:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=671eaaac0caac4826d6182bd5a57c9e0a8ed7a27'/>
<id>urn:sha1:671eaaac0caac4826d6182bd5a57c9e0a8ed7a27</id>
<content type='text'>
"git diff --cached" codepath did not fill the necessary stat
information for a file when fsmonitor knows it is clean and ended
up behaving as if it is not clean, which has been corrected.

* js/diff-cached-fsmonitor-fix:
  diff-lib: fix check_removed when fsmonitor is on
</content>
</entry>
<entry>
<title>diff-lib: fix check_removed() when fsmonitor is active</title>
<updated>2023-09-16T00:13:14Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-09-14T22:00:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=811c9c210265a16514fd1b5a513d4b028d711410'/>
<id>urn:sha1:811c9c210265a16514fd1b5a513d4b028d711410</id>
<content type='text'>
`git diff-index` may return incorrect deleted entries when fsmonitor
is used in a repository with git submodules. This can be observed on
Mac machines, but it can affect all other supported platforms too.

If fsmonitor is used, `stat *st` is left uninitialied if cache_entry
has CE_FSMONITOR_VALID bit set.  But, there are three call sites
that rely on stat afterwards, which can result in incorrect results.

We can fill members of "struct stat" that matters well enough using
the information we have in "struct cache_entry" that fsmonitor told
us is up-to-date to solve this.

Helped-by: Josip Sokcevic &lt;sokcevic@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'js/diff-cached-fsmonitor-fix' into jc/diff-cached-fsmonitor-fix</title>
<updated>2023-09-16T00:08:02Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-09-16T00:08:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=161c35f93b9a742b5ec5c69eaea4e39db7343d19'/>
<id>urn:sha1:161c35f93b9a742b5ec5c69eaea4e39db7343d19</id>
<content type='text'>
* js/diff-cached-fsmonitor-fix:
  diff-lib: fix check_removed when fsmonitor is on
</content>
</entry>
<entry>
<title>diff-lib: fix check_removed when fsmonitor is on</title>
<updated>2023-09-11T23:45:49Z</updated>
<author>
<name>Josip Sokcevic</name>
<email>sokcevic@google.com</email>
</author>
<published>2023-09-11T17:09:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6a044a20480a8ef56f7ddb8142f660ca01a3391e'/>
<id>urn:sha1:6a044a20480a8ef56f7ddb8142f660ca01a3391e</id>
<content type='text'>
`git diff-index` may return incorrect deleted entries when fsmonitor
is used in a repository with git submodules. This can be observed on
Mac machines, but it can affect all other supported platforms too.

If fsmonitor is used, `stat *st` is not initialized if cache_entry has
CE_FSMONITOR_VALID set. But, there are three call sites that rely on stat
afterwards, which can result in incorrect results.

This change partially reverts commit 4f3d6d02 (fsmonitor: skip lstat
deletion check during git diff-index, 2021-03-17).

Signed-off-by: Josip Sokcevic &lt;sokcevic@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff: drop useless return from run_diff_{files,index} functions</title>
<updated>2023-08-21T22:33:24Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2023-08-21T20:18:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=25bd3acd048152dcf2de5f446d2bd21b5fb42b09'/>
<id>urn:sha1:25bd3acd048152dcf2de5f446d2bd21b5fb42b09</id>
<content type='text'>
Neither of these functions ever returns a value other than zero.
Instead, they expect unrecoverable errors to exit immediately, and
things like "--exit-code" are stored inside the diff_options struct to
be handled later via diff_result_code().

Some callers do check the return values, but many don't bother. Let's
drop the useless return values, which are misleading callers about how
the functions work. This could be seen as a step in the wrong direction,
as we might want to eventually "lib-ify" these to more cleanly return
errors up the stack, in which case we'd have to add the return values
back in. But there are some benefits to doing this now:

  1. In the current code, somebody could accidentally add a "return -1"
     to one of the functions, which would be erroneously ignored by many
     callers. By removing the return code, the compiler can notice the
     mismatch and force the developer to decide what to do.

     Obviously the other option here is that we could start consistently
     checking the error code in every caller. But it would be dead code,
     and we wouldn't get any compile-time help in catching new cases.

  2. It communicates the situation to callers, who may want to choose a
     different function. These functions are really thin wrappers for
     doing git-diff-files and git-diff-index within the process. But
     callers who care about recovering from an error here are probably
     better off using the underlying library functions, many of
     which do return errors.

If somebody eventually wants to teach these functions to propagate
errors, they'll have to switch back to returning a value, effectively
reverting this patch. But at least then they will be starting with a
level playing field: they know that they will need to inspect each
caller to see how it should handle the error.

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