<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-submodule.sh, 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-16T22:07:43Z</updated>
<entry>
<title>submodule: move core cmd_update() logic to C</title>
<updated>2022-03-16T22:07:43Z</updated>
<author>
<name>Atharva Raykar</name>
<email>raykar.ath@gmail.com</email>
</author>
<published>2022-03-15T21:09:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b3c5f5cb04854b56b39a40696c366053c8f09b58'/>
<id>urn:sha1:b3c5f5cb04854b56b39a40696c366053c8f09b58</id>
<content type='text'>
This patch completes the conversion past the flag parsing of
`submodule update` by introducing a helper subcommand called
`submodule--helper update`. The behaviour of `submodule update` should
remain the same after this patch.

Prior to this patch, `submodule update` was implemented by piping the
output of `update-clone` (which clones all missing submodules, then
prints relevant information for all submodules) into
`run-update-procedure` (which reads the information and updates the
submodule tree).

With `submodule--helper update`, we iterate over the submodules and
update the submodule tree in the same process. This reuses most of
existing code structure, except that `update_submodule()` now updates
the submodule tree (instead of printing submodule information to be
consumed by another process).

Recursing on a submodule is done by calling a subprocess that launches
`submodule--helper update`, with a modified `--recursive-prefix` and
`--prefix` parameter.

Mentored-by: Christian Couder &lt;christian.couder@gmail.com&gt;
Mentored-by: Shourya Shukla &lt;periperidip@gmail.com&gt;
Signed-off-by: Atharva Raykar &lt;raykar.ath@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;
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--helper: teach update_data more options</title>
<updated>2022-03-16T22:07:43Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2022-03-15T21:09:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c9911c9358e611390e2444f718c73900d17d3d60'/>
<id>urn:sha1:c9911c9358e611390e2444f718c73900d17d3d60</id>
<content type='text'>
Refactor 'struct update_data' to hold the parsed args needed by "git
submodule--helper update" and refactor "update-clone" and
"run-update-procedure" (the functions that will be combined to form
"update") to use these options.

For "run-update-procedure", 'struct update_data' already holds its args,
so only arg parsing code needs to be updated.

For "update-clone", move its args from 'struct submodule_update_clone'
into 'struct update_data', and replace them with a pointer to 'struct
update_data'. Its other members hold the submodule iteration state of
"update-clone", so those are unchanged.

Incidentally, since we reformat the designated initializers of the
affected structs, also reformat MODULE_CLONE_DATA_INIT for consistency.

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 update: use die_message()</title>
<updated>2022-03-16T22:07:43Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2022-03-15T21:09:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=55b3f12cb54077463709b2ac20cc64eba7dbf673'/>
<id>urn:sha1:55b3f12cb54077463709b2ac20cc64eba7dbf673</id>
<content type='text'>
Use die_message() to print the "fatal: " prefix instead of doing it in
git-submodule.sh and remove a now-unnecessary exit code from "git
submodule--helper run-update-procedure".

Also, since die_message() adds the newline for us, replace an invocation
of die_with_status() with printf + exit invocations that do not add a
newline, but are otherwise identical to die_with_status().

Helped-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
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--helper update-clone: check for --filter and --init</title>
<updated>2022-03-05T00:39:13Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2022-03-05T00:14:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c9d256249375c7b8a1773139791448860b5789ff'/>
<id>urn:sha1:c9d256249375c7b8a1773139791448860b5789ff</id>
<content type='text'>
"git submodule update --filter" also requires the "--init" option. Teach
update-clone to do this usage check in C and remove the check from
git-submodule.sh.

In addition, change update-clone's usage string so that it teaches users
about "git submodule update" instead of "git submodule--helper
update-clone" (the string is copied from git-submodule.sh). This should
be more helpful to users since they don't invoke update-clone directly.

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--helper: remove ensure-core-worktree</title>
<updated>2022-03-05T00:39:12Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2022-03-05T00:13:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=97cb977c8243c3393a85d662456a1e161596f211'/>
<id>urn:sha1:97cb977c8243c3393a85d662456a1e161596f211</id>
<content type='text'>
Move the logic of "git submodule--helper ensure-core-worktree" into
run-update-procedure, and since this makes the ensure-core-worktree
command obsolete, remove it.

As a result, the order of two operations in git-submodule.sh is
reversed: 'set the value of core.worktree' now happens after the call to
"git submodule--helper relative-path". This is safe - "relative-path"
does not depend on the value of core.worktree.

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--helper update-clone: learn --init</title>
<updated>2022-03-05T00:39:12Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2022-03-05T00:13:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=29a5e9e1ffeadb0555fdd2f366f1cb7259462ab9'/>
<id>urn:sha1:29a5e9e1ffeadb0555fdd2f366f1cb7259462ab9</id>
<content type='text'>
Teach "git submodule--helper update-clone" the --init flag and remove
the corresponding shell code.

When the `--init` flag is passed to the subcommand, we do not spawn a
new subprocess and call `submodule--helper init` on the submodule paths,
because the Git machinery is not able to pick up the configuration
changes introduced by that init call. So we instead run the
`init_submodule_cb()` callback over each submodule in the same process.

[1] https://lore.kernel.org/git/CAP8UFD0NCQ5w_3GtT_xHr35i7h8BuLX4UcHNY6VHPGREmDVObA@mail.gmail.com/

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--helper run-update-procedure: learn --remote</title>
<updated>2022-03-05T00:39:12Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2022-03-05T00:13:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1012a5cbc3fe4bcfae278a8103e60054d2674784'/>
<id>urn:sha1:1012a5cbc3fe4bcfae278a8103e60054d2674784</id>
<content type='text'>
Teach run-update-procedure to handle --remote instead of parsing
--remote in git-submodule.sh. As a result, "git submodule--helper
[print-default-remote|remote-branch]" have no more callers, so remove
them.

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--helper run-update-procedure: remove --suboid</title>
<updated>2022-03-05T00:39:11Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2022-03-05T00:13:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e44196659634fdc42672888f5a91e94303052284'/>
<id>urn:sha1:e44196659634fdc42672888f5a91e94303052284</id>
<content type='text'>
Teach run-update-procedure to determine the oid of the submodule's HEAD
instead of doing it in git-submodule.sh.

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>clone, submodule: pass partial clone filters to submodules</title>
<updated>2022-02-09T23:38:36Z</updated>
<author>
<name>Josh Steadmon</name>
<email>steadmon@google.com</email>
</author>
<published>2022-02-05T05:00:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f05da2b48b48a46db65fc768b3ffecaf996dd655'/>
<id>urn:sha1:f05da2b48b48a46db65fc768b3ffecaf996dd655</id>
<content type='text'>
When cloning a repo with a --filter and with --recurse-submodules
enabled, the partial clone filter only applies to the top-level repo.
This can lead to unexpected bandwidth and disk usage for projects which
include large submodules. For example, a user might wish to make a
partial clone of Gerrit and would run:
`git clone --recurse-submodules --filter=blob:5k https://gerrit.googlesource.com/gerrit`.
However, only the superproject would be a partial clone; all the
submodules would have all blobs downloaded regardless of their size.
With this change, the same filter can also be applied to submodules,
meaning the expected bandwidth and disk savings apply consistently.

To avoid changing default behavior, add a new clone flag,
`--also-filter-submodules`. When this is set along with `--filter` and
`--recurse-submodules`, the filter spec is passed along to git-submodule
and git-submodule--helper, such that submodule clones also have the
filter applied.

This applies the same filter to the superproject and all submodules.
Users who need to customize the filter per-submodule would need to clone
with `--no-recurse-submodules` and then manually initialize each
submodule with the proper filter.

Applying filters to submodules should be safe thanks to Jonathan Tan's
recent work [1, 2, 3] eliminating the use of alternates as a method of
accessing submodule objects, so any submodule object access now triggers
a lazy fetch from the submodule's promisor remote if the accessed object
is missing. This patch is a reworked version of [4], which was created
prior to Jonathan Tan's work.

[1]: 8721e2e (Merge branch 'jt/partial-clone-submodule-1', 2021-07-16)
[2]: 11e5d0a (Merge branch 'jt/grep-wo-submodule-odb-as-alternate',
	2021-09-20)
[3]: 162a13b (Merge branch 'jt/no-abuse-alternate-odb-for-submodules',
	2021-10-25)
[4]: https://lore.kernel.org/git/52bf9d45b8e2b72ff32aa773f2415bf7b2b86da2.1563322192.git.steadmon@google.com/

Signed-off-by: Josh Steadmon &lt;steadmon@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ab/unused-script-helpers'</title>
<updated>2021-09-23T20:44:47Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-09-23T20:44:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=57e4a7b633d00f274051d436edcec14ad98969c3'/>
<id>urn:sha1:57e4a7b633d00f274051d436edcec14ad98969c3</id>
<content type='text'>
Code clean-up.

* ab/unused-script-helpers:
  test-lib: remove unused $_x40 and $_z40 variables
  git-bisect: remove unused SHA-1 $x40 shell variable
  git-sh-setup: remove unused "pull with rebase" message
  git-submodule: remove unused is_zero_oid() function
</content>
</entry>
</feed>
