<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/submodule.c, branch v2.36.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.36.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.36.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-03-29T19:22:03Z</updated>
<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>
<entry>
<title>submodule: move logic into fetch_task_create()</title>
<updated>2022-03-08T00:51:03Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2022-03-08T00:14:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5370b91f3fae9d7a511e23142b55082200152cef'/>
<id>urn:sha1:5370b91f3fae9d7a511e23142b55082200152cef</id>
<content type='text'>
get_fetch_task() gets a fetch task by iterating the index; a future
commit will introduce a similar function, get_fetch_task_from_changed(),
that gets a fetch task from the list of changed submodules. Both
functions are similar in that they need to:

* create a fetch task
* initialize the submodule repo for the fetch task
* determine the default recursion mode

Move all of this logic into fetch_task_create() so that it is no longer
split between fetch_task_create() and get_fetch_task(). This will make
it easier to share code with get_fetch_task_from_changed().

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>submodule: extract get_fetch_task()</title>
<updated>2022-03-08T00:51:03Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2022-03-08T00:14:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=73bc90d7e19c471318e799624b6d4c6d449c655d'/>
<id>urn:sha1:73bc90d7e19c471318e799624b6d4c6d449c655d</id>
<content type='text'>
get_next_submodule() configures the parallel submodule fetch by
performing two functions:

* iterate the index to find submodules
* configure the child processes to fetch the submodules found in the
  previous step

Extract the index iterating code into an iterator function,
get_fetch_task(), so that get_next_submodule() is agnostic of how
to find submodules. This prepares for a subsequent commit will teach the
fetch machinery to also iterate through the list of changed
submodules (in addition to the index).

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>submodule: store new submodule commits oid_array in a struct</title>
<updated>2022-03-08T00:51:03Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2022-03-08T00:14:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6e1e0c9959f1df4b8c5aafb69d149374720b26dc'/>
<id>urn:sha1:6e1e0c9959f1df4b8c5aafb69d149374720b26dc</id>
<content type='text'>
This commit prepares for a future commit that will teach `git fetch
--recurse-submodules` how to fetch submodules that are present in
&lt;gitdir&gt;/modules, but are not populated. To do this, we need to store
more information about the changed submodule so that we can read the
submodule configuration from the superproject commit instead of the
filesystem.

Refactor the changed submodules string_list.util to hold a struct
instead of an oid_array. This struct only holds the new_commits
oid_array for now; more information will be added later.

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>submodule: inline submodule_commits() into caller</title>
<updated>2022-03-08T00:51:03Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2022-03-08T00:14:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1e5dd3a1114643ca43e3d83da4f5c44447f061ff'/>
<id>urn:sha1:1e5dd3a1114643ca43e3d83da4f5c44447f061ff</id>
<content type='text'>
When collecting the string_list of changed submodule names, the new
submodules commits are stored in the string_list_item.util as an
oid_array. A subsequent commit will replace the oid_array with a struct
that has more information.

Prepare for this change by inlining submodule_commits() (which inserts
into the string_list and initializes the string_list_item.util) into its
only caller so that the code is easier to refactor later.

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>submodule: make static functions read submodules from commits</title>
<updated>2022-03-08T00:51:03Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2022-03-08T00:14:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7c2f8cc58cc3648a0e1e4c76be15a09114b4d9dd'/>
<id>urn:sha1:7c2f8cc58cc3648a0e1e4c76be15a09114b4d9dd</id>
<content type='text'>
A future commit will teach "fetch --recurse-submodules" to fetch
unpopulated submodules. To prepare for this, teach the necessary static
functions how to read submodules from superproject commits using a
"treeish_name" argument (instead of always reading from the index and
filesystem) but do not actually change where submodules are read from.
Submodules will be read from commits when we fetch unpopulated
submodules.

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>branch: add --recurse-submodules option for branch creation</title>
<updated>2022-02-04T16:16:39Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2022-01-29T00:04:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=961b130d20c9aea322b94a639a63ec8cca9f14fc'/>
<id>urn:sha1:961b130d20c9aea322b94a639a63ec8cca9f14fc</id>
<content type='text'>
To improve the submodules UX, we would like to teach Git to handle
branches in submodules. Start this process by teaching "git branch" the
--recurse-submodules option so that "git branch --recurse-submodules
topic" will create the `topic` branch in the superproject and its
submodules.

Although this commit does not introduce breaking changes, it does not
work well with existing --recurse-submodules commands because "git
branch --recurse-submodules" writes to the submodule ref store, but most
commands only consider the superproject gitlink and ignore the submodule
ref store. For example, "git checkout --recurse-submodules" will check
out the commits in the superproject gitlinks (and put the submodules in
detached HEAD) instead of checking out the submodule branches.

Because of this, this commit introduces a new configuration value,
`submodule.propagateBranches`. The plan is for Git commands to
prioritize submodule ref store information over superproject gitlinks if
this value is true. Because "git branch --recurse-submodules" writes to
submodule ref stores, for the sake of clarity, it will not function
unless this configuration value is set.

This commit also includes changes that support working with submodules
from a superproject commit because "branch --recurse-submodules" (and
future commands) need to read .gitmodules and gitlinks from the
superproject commit, but submodules are typically read from the
filesystem's .gitmodules and the index's gitlinks. These changes are:

* add a submodules_of_tree() helper that gives the relevant
  information of an in-tree submodule (e.g. path and oid) and
  initializes the repository
* add is_tree_submodule_active() by adding a treeish_name parameter to
  is_submodule_active()
* add the "submoduleNotUpdated" advice to advise users to update the
  submodules in their trees

Incidentally, fix an incorrect usage string that combined the 'list'
usage of git branch (-l) with the 'create' usage; this string has been
incorrect since its inception, a8dfd5eac4 (Make builtin-branch.c use
parse_options., 2007-10-07).

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