<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/commit.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-06T23:03:34Z</updated>
<entry>
<title>add API: remove run_add_interactive() wrapper function</title>
<updated>2023-02-06T23:03:34Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2023-02-06T22:58:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d21878f073043b9205f5049f1cd53560d67b9f3f'/>
<id>urn:sha1:d21878f073043b9205f5049f1cd53560d67b9f3f</id>
<content type='text'>
Now that the Perl "git-add--interactive" has gone away in the
preceding commit we don't need to pass along our desire for a mode as
a string, and can instead directly use the "enum add_p_mode", see
d2a233cb8b9 (built-in add -p: prepare for patch modes other than
"stage", 2019-12-21) for its introduction.

As a result of that the run_add_interactive() function would become a
trivial wrapper which would only run run_add_i() if a 0 (or now,
"NULL") "patch_mode" was provided. Let's instead remove it, and have
the one callsite that wanted the "NULL" case (interactive_add())
handle it.

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>rebase: be stricter when reading state files containing oids</title>
<updated>2022-10-17T18:53:00Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2022-10-17T13:17:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b8dbfd030ccc8e5be6b22bc28a342119504e0c2b'/>
<id>urn:sha1:b8dbfd030ccc8e5be6b22bc28a342119504e0c2b</id>
<content type='text'>
The state files for 'onto' and 'orig_head' should contain a full hex
oid, change the reading functions from get_oid() to get_oid_hex() to
reflect this. They should also name commits and not tags so add and use
a function that looks up a commit from an oid like
lookup_commit_reference() but without dereferencing tags.

Suggested-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>shallow: reset commit grafts when shallow is reset</title>
<updated>2022-03-18T00:44:38Z</updated>
<author>
<name>Jonathan Tan</name>
<email>jonathantanmy@google.com</email>
</author>
<published>2022-03-17T18:24:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2a69ff09d5654de31361365e3faf9f8495f03ed7'/>
<id>urn:sha1:2a69ff09d5654de31361365e3faf9f8495f03ed7</id>
<content type='text'>
When reset_repository_shallow() is called, Git clears its cache of
shallow information, so that if shallow information is re-requested, Git
will read fresh data from disk instead of reusing its stale cached data.
However, the cache of commit grafts is not likewise cleared, even though
there are commit grafts created from shallow information.

This means that if on-disk shallow information were to be updated and
then a commit-graft-using codepath were run (for example, a revision
walk), Git would be using stale commit graft information. This can be
seen from the test in this patch, in which Git performs a revision walk
(to check for changed submodules) after a fetch with --update-shallow.

Therefore, clear the cache of commit grafts whenever
reset_repository_shallow() is called.

Signed-off-by: Jonathan Tan &lt;jonathantanmy@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>hooks: fix an obscure TOCTOU "did we just run a hook?" race</title>
<updated>2022-03-07T21:00:53Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-03-07T12:33:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a8cc594333848713b8e772cccf8159196ea85ede'/>
<id>urn:sha1:a8cc594333848713b8e772cccf8159196ea85ede</id>
<content type='text'>
Fix a Time-of-check to time-of-use (TOCTOU) race in code added in
680ee550d72 (commit: skip discarding the index if there is no
pre-commit hook, 2017-08-14).

This obscure race condition can occur if we e.g. ran the "pre-commit"
hook and it modified the index, but hook_exists() returns false later
on (e.g., because the hook itself went away, the directory became
unreadable, etc.). Then we won't call discard_cache() when we should
have.

The race condition itself probably doesn't matter, and users would
have been unlikely to run into it in practice. This problem has been
noted on-list when 680ee550d72 was discussed[1], but had not been
fixed.

This change is mainly intended to improve the readability of the code
involved, and to make reasoning about it more straightforward. It
wasn't as obvious what we were trying to do here, but by having an
"invoked_hook" it's clearer that e.g. our discard_cache() is happening
because of the earlier hook execution.

Let's also change this for the push-to-checkout hook. Now instead of
checking if the hook exists and either doing a push to checkout or a
push to deploy we'll always attempt a push to checkout. If the hook
doesn't exist we'll fall back on push to deploy. The same behavior as
before, without the TOCTOU race. See 0855331941b (receive-pack:
support push-to-checkout hook, 2014-12-01) for the introduction of the
previous behavior.

This leaves uses of hook_exists() in two places that matter. The
"reference-transaction" check in refs.c, see 67541597670 (refs:
implement reference transaction hook, 2020-06-19), and the
"prepare-commit-msg" hook, see 66618a50f9c (sequencer: run
'prepare-commit-msg' hook, 2018-01-24).

In both of those cases we're saving ourselves CPU time by not
preparing data for the hook that we'll then do nothing with if we
don't have the hook. So using this "invoked_hook" pattern doesn't make
sense in those cases.

The "reference-transaction" and "prepare-commit-msg" hook also aren't
racy. In those cases we'll skip the hook runs if we race with a new
hook being added, whereas in the TOCTOU races being fixed here we were
incorrectly skipping the required post-hook logic.

1. https://lore.kernel.org/git/20170810191613.kpmhzg4seyxy3cpq@sigill.intra.peff.net/

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>receive-pack.c: consolidate find header logic</title>
<updated>2022-01-06T21:17:20Z</updated>
<author>
<name>John Cai</name>
<email>johncai86@gmail.com</email>
</author>
<published>2022-01-06T20:07:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cfc5cf428bcc8ff31748bba97baee31f529a30ea'/>
<id>urn:sha1:cfc5cf428bcc8ff31748bba97baee31f529a30ea</id>
<content type='text'>
There are two functions that have very similar logic of finding a header
value. find_commit_header, and find_header. We can conslidate the logic
by introducing a new function find_header_mem, which is equivalent to
find_commit_header except it takes a len parameter that determines how
many bytes will be read. find_commit_header and find_header can then both
call find_header_mem.

This reduces duplicate logic, as the logic for finding header values
can now all live in one place.

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>advice: move advice.graftFileDeprecated squashing to commit.[ch]</title>
<updated>2021-08-25T19:07:52Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-08-23T10:44:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ab628588f80e8dd889b700515c41548c1a356dcc'/>
<id>urn:sha1:ab628588f80e8dd889b700515c41548c1a356dcc</id>
<content type='text'>
Move the squashing of the advice.graftFileDeprecated advice over to an
external variable in commit.[ch], allowing advice() to purely use the
new-style API of invoking advice() with an enum.

See 8821e90a09a (advice: don't pointlessly suggest
--convert-graft-file, 2018-11-27) for why quieting this advice was
needed. It's more straightforward to move this code to commit.[ch] and
use it builtin/replace.c, than to go through the indirection of
advice.[ch].

Because this was the last advice_config variable we can remove that
old facility from advice.c.

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 'cm/rebase-i-fixup-amend-reword'</title>
<updated>2021-03-26T21:59:03Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-03-26T21:59:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=89519f662c9e2b1c406fa72ba7923fcf5c028e89'/>
<id>urn:sha1:89519f662c9e2b1c406fa72ba7923fcf5c028e89</id>
<content type='text'>
"git commit --fixup=&lt;commit&gt;", which was to tweak the changes made
to the contents while keeping the original log message intact,
learned "--fixup=(amend|reword):&lt;commit&gt;", that can be used to
tweak both the message and the contents, and only the message,
respectively.

* cm/rebase-i-fixup-amend-reword:
  doc/git-commit: add documentation for fixup=[amend|reword] options
  t3437: use --fixup with options to create amend! commit
  t7500: add tests for --fixup=[amend|reword] options
  commit: add a reword suboption to --fixup
  commit: add amend suboption to --fixup to create amend! commit
  sequencer: export and rename subject_length()
</content>
</entry>
<entry>
<title>sequencer: export and rename subject_length()</title>
<updated>2021-03-15T21:29:35Z</updated>
<author>
<name>Charvi Mendiratta</name>
<email>charvi077@gmail.com</email>
</author>
<published>2021-03-15T07:54:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6e0e28877988f8b98eb1e5cf4d4c5d29cc0b7f77'/>
<id>urn:sha1:6e0e28877988f8b98eb1e5cf4d4c5d29cc0b7f77</id>
<content type='text'>
This function can be used in other parts of git. Let's move the
function to commit.c and also rename it to make the name of the
function more generic.

Mentored-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Mentored-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Helped-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Charvi Mendiratta &lt;charvi077@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'bc/signed-objects-with-both-hashes'</title>
<updated>2021-02-23T00:12:42Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-02-23T00:12:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=15af6e6fee54632358798bef548d89dd3764805d'/>
<id>urn:sha1:15af6e6fee54632358798bef548d89dd3764805d</id>
<content type='text'>
Signed commits and tags now allow verification of objects, whose
two object names (one in SHA-1, the other in SHA-256) are both
signed.

* bc/signed-objects-with-both-hashes:
  gpg-interface: remove other signature headers before verifying
  ref-filter: hoist signature parsing
  commit: allow parsing arbitrary buffers with headers
  gpg-interface: improve interface for parsing tags
  commit: ignore additional signatures when parsing signed commits
  ref-filter: switch some uses of unsigned long to size_t
</content>
</entry>
<entry>
<title>Merge branch 'ds/commit-graph-genno-fix'</title>
<updated>2021-02-18T01:21:40Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-02-18T01:21:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5bd0b21bf78fa365bc5189452e3cbbbec7330002'/>
<id>urn:sha1:5bd0b21bf78fa365bc5189452e3cbbbec7330002</id>
<content type='text'>
Fix incremental update of commit-graph file around corrected commit
date data.

* ds/commit-graph-genno-fix:
  commit-graph: prepare commit graph
  commit-graph: be extra careful about mixed generations
  commit-graph: compute generations separately
  commit-graph: validate layers for generation data
  commit-graph: always parse before commit_graph_data_at()
  commit-graph: use repo_parse_commit
</content>
</entry>
</feed>
