<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/submodule.c, branch v2.37.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.37.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.37.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-06-10T22:04:13Z</updated>
<entry>
<title>Merge branch 'ab/env-array'</title>
<updated>2022-06-10T22:04:13Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-06-10T22:04:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c21fa3bb549a7769f9d508f0a5f95c654539e1f7'/>
<id>urn:sha1:c21fa3bb549a7769f9d508f0a5f95c654539e1f7</id>
<content type='text'>
Rename .env_array member to .env in the child_process structure.

* ab/env-array:
  run-command API users: use "env" not "env_array" in comments &amp; names
  run-command API: rename "env_array" to "env"
</content>
</entry>
<entry>
<title>Merge branch 'ab/plug-leak-in-revisions'</title>
<updated>2022-06-07T21:10:56Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-06-07T21:10:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2da81d1efb0166e1cec7a8582b837994dde6225b'/>
<id>urn:sha1:2da81d1efb0166e1cec7a8582b837994dde6225b</id>
<content type='text'>
Plug the memory leaks from the trickiest API of all, the revision
walker.

* ab/plug-leak-in-revisions: (27 commits)
  revisions API: add a TODO for diff_free(&amp;revs-&gt;diffopt)
  revisions API: have release_revisions() release "topo_walk_info"
  revisions API: have release_revisions() release "date_mode"
  revisions API: call diff_free(&amp;revs-&gt;pruning) in revisions_release()
  revisions API: release "reflog_info" in release revisions()
  revisions API: clear "boundary_commits" in release_revisions()
  revisions API: have release_revisions() release "prune_data"
  revisions API: have release_revisions() release "grep_filter"
  revisions API: have release_revisions() release "filter"
  revisions API: have release_revisions() release "cmdline"
  revisions API: have release_revisions() release "mailmap"
  revisions API: have release_revisions() release "commits"
  revisions API users: use release_revisions() for "prune_data" users
  revisions API users: use release_revisions() with UNLEAK()
  revisions API users: use release_revisions() in builtin/log.c
  revisions API users: use release_revisions() in http-push.c
  revisions API users: add "goto cleanup" for release_revisions()
  stash: always have the owner of "stash_info" free it
  revisions API users: use release_revisions() needing REV_INFO_INIT
  revision.[ch]: document and move code declared around "init"
  ...
</content>
</entry>
<entry>
<title>run-command API: rename "env_array" to "env"</title>
<updated>2022-06-02T21:31:16Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-06-02T09:09:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=29fda24dd11e90583f3ea9ff2f90ee9acacd7792'/>
<id>urn:sha1:29fda24dd11e90583f3ea9ff2f90ee9acacd7792</id>
<content type='text'>
Start following-up on the rename mentioned in c7c4bdeccf3 (run-command
API: remove "env" member, always use "env_array", 2021-11-25) of
"env_array" to "env".

The "env_array" name was picked in 19a583dc39e (run-command: add
env_array, an optional argv_array for env, 2014-10-19) because "env"
was taken. Let's not forever keep the oddity of "*_array" for this
"struct strvec", but not for its "args" sibling.

This commit is almost entirely made with a coccinelle rule[1]. The
only manual change here is in run-command.h to rename the struct
member itself and to change "env_array" to "env" in the
CHILD_PROCESS_INIT initializer.

The rest of this is all a result of applying [1]:

 * make contrib/coccinelle/run_command.cocci.patch
 * patch -p1 &lt;contrib/coccinelle/run_command.cocci.patch
 * git add -u

1. cat contrib/coccinelle/run_command.pending.cocci
   @@
   struct child_process E;
   @@
   - E.env_array
   + E.env

   @@
   struct child_process *E;
   @@
   - E-&gt;env_array
   + E-&gt;env

I've avoided changing any comments and derived variable names here,
that will all be done in the next commit.

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>revisions API users: use release_revisions() needing REV_INFO_INIT</title>
<updated>2022-04-14T06:56:08Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-04-13T20:01:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f196c1e908db9242206e1fc9c64f33baf92676bb'/>
<id>urn:sha1:f196c1e908db9242206e1fc9c64f33baf92676bb</id>
<content type='text'>
Use release_revisions() to various users of "struct rev_list" which
need to have their "struct rev_info" zero-initialized before we can
start using it.

For the bundle.c code see the early exit case added in
3bbbe467f29 (bundle verify: error out if called without an object
database, 2019-05-27).

For the relevant bisect.c code see 45b6370812c (bisect: libify
`check_good_are_ancestors_of_bad` and its dependents, 2020-02-17).

For the submodule.c code see the "goto" on "(!left || !right || !sub)"
added in 8e6df65015f (submodule: refactor show_submodule_summary with
helper function, 2016-08-31).

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>revisions API users: add straightforward release_revisions()</title>
<updated>2022-04-14T06:56:08Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-04-13T20:01:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2108fe4a1976f95821e13503fd331f075da398c6'/>
<id>urn:sha1:2108fe4a1976f95821e13503fd331f075da398c6</id>
<content type='text'>
Add a release_revisions() to various users of "struct rev_list" in
those straightforward cases where we only need to add the
release_revisions() call to the end of a block, and don't need to
e.g. refactor anything to use a "goto cleanup" pattern.

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>cocci: add and apply free_commit_list() rules</title>
<updated>2022-04-14T06:56:08Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-04-13T20:01:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bf20fe4ca8c8d2ba2087c9c44b4ee09a1d1467ed'/>
<id>urn:sha1:bf20fe4ca8c8d2ba2087c9c44b4ee09a1d1467ed</id>
<content type='text'>
Add and apply coccinelle rules to remove "if (E)" before
"free_commit_list(E)", the function can accept NULL, and further
change cases where "E = NULL" followed to also be unconditionally.

The code changes in this commit were entirely made by the coccinelle
rule being added here, and applied with:

    make contrib/coccinelle/free.cocci.patch
    patch -p1 &lt;contrib/coccinelle/free.cocci.patch

The only manual intervention here is that the the relevant code in
commit.c has been manually re-indented.

Suggested-by: Phillip Wood &lt;phillip.wood123@gmail.com&gt;
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 'jt/reset-grafts-when-resetting-shallow'</title>
<updated>2022-03-29T19:22:03Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-03-29T19:22:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5fe35fcc790f6df1839ff984896f9d5e6710d012'/>
<id>urn:sha1:5fe35fcc790f6df1839ff984896f9d5e6710d012</id>
<content type='text'>
When "shallow" information is updated, we forgot to update the
in-core equivalent, which has been corrected.

* jt/reset-grafts-when-resetting-shallow:
  shallow: reset commit grafts when shallow is reset
</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>submodule: fix latent check_has_commit() bug</title>
<updated>2022-03-16T23:08:59Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2022-03-08T00:14:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5fff35d880df2bb4cfce032c54a95abadce3f881'/>
<id>urn:sha1:5fff35d880df2bb4cfce032c54a95abadce3f881</id>
<content type='text'>
When check_has_commit() is called on a missing submodule, initialization
of the struct repository fails, but it attempts to clear the struct
anyway (which is a fatal error). This bug is masked by its only caller,
submodule_has_commits(), first calling add_submodule_odb(). The latter
fails if the submodule does not exist, making submodule_has_commits()
exit early and not invoke check_has_commit().

Fix this bug, and because calling add_submodule_odb() is no longer
necessary as of 13a2f620b2 (submodule: pass repo to
check_has_commit(), 2021-10-08), remove that call too.

This is the last caller of add_submodule_odb(), so remove that
function. (Submodule ODBs are still added as alternates via
add_submodule_odb_by_path().)

Signed-off-by: Glen Choo &lt;chooglen@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fetch: fetch unpopulated, changed submodules</title>
<updated>2022-03-16T23:08:59Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2022-03-08T00:14:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b90d9f7632d380d3f16197ae657ab57075acd1eb'/>
<id>urn:sha1:b90d9f7632d380d3f16197ae657ab57075acd1eb</id>
<content type='text'>
"git fetch --recurse-submodules" only considers populated
submodules (i.e. submodules that can be found by iterating the index),
which makes "git fetch" behave differently based on which commit is
checked out. As a result, even if the user has initialized all submodules
correctly, they may not fetch the necessary submodule commits, and
commands like "git checkout --recurse-submodules" might fail.

Teach "git fetch" to fetch cloned, changed submodules regardless of
whether they are populated. This is in addition to the current behavior
of fetching populated submodules (which is always attempted regardless
of what was fetched in the superproject, or even if nothing was fetched
in the superproject).

A submodule may be encountered multiple times (via the list of
populated submodules or via the list of changed submodules). When this
happens, "git fetch" only reads the 'populated copy' and ignores the
'changed copy'. Amend the verify_fetch_result() test helper so that we
can assert on which 'copy' is being read.

Signed-off-by: Glen Choo &lt;chooglen@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
