From: Junio C Hamano <gitster@pobox.com>
To: "Orgad Shaneh via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Orgad Shaneh <orgads@gmail.com>,
Glen Choo <chooglen@google.com>
Subject: Re: [PATCH v2] submodule--helper: fix initialization of warn_if_uninitialized
Date: Mon, 25 Apr 2022 13:56:24 -0700 [thread overview]
Message-ID: <xmqqtuagvq4n.fsf@gitster.g> (raw)
In-Reply-To: <xmqq35i1vx3y.fsf@gitster.g> (Junio C. Hamano's message of "Mon, 25 Apr 2022 11:25:37 -0700")
Junio C Hamano <gitster@pobox.com> writes:
> Is this a fix we can protect from future breakge by adding a test or
> tweaking an existing test? It is kind of surprising if we did not
> have any test that runs "git submodule update" in a superproject
> with initialized and uninitialized submodule(s) and make sure only
> the initialized ones are updated. It may be the matter of examining
> the warning output that is currently ignored in such a test, if
> there is one.
Here is a quick-and-dirty one I came up with. The superproject
"super" has a handful of submodules ("submodule" and "rebasing"
being two of them), so the new tests clone the superproject and
initializes only one submodule. Then we see how "submodule update"
with pathspec works with these two submodules (one initialied and
the other not). In another test, we see how "submodule update"
without pathspec works.
I'll queue this on top of your fix for now tentatively. If nobody
finds flaws in them, I'll just squash it in soonish before merging
the whole thing for the maintenance track.
Thanks.
t/t7406-submodule-update.sh | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git c/t/t7406-submodule-update.sh w/t/t7406-submodule-update.sh
index 000e055811..43f779d751 100755
--- c/t/t7406-submodule-update.sh
+++ w/t/t7406-submodule-update.sh
@@ -670,6 +670,39 @@ test_expect_success 'submodule update --init skips submodule with update=none' '
)
'
+test_expect_success 'submodule update with pathspec warns against uninitialized ones' '
+ test_when_finished "rm -fr selective" &&
+ git clone super selective &&
+ (
+ cd selective &&
+ git submodule init submodule &&
+
+ git submodule update submodule 2>err &&
+ ! grep "Submodule path .* not initialized" err &&
+
+ git submodule update rebasing 2>err &&
+ grep "Submodule path .rebasing. not initialized" err &&
+
+ test_path_exists submodule/.git &&
+ test_path_is_missing rebasing/.git
+ )
+
+'
+
+test_expect_success 'submodule update without pathspec updates only initialized ones' '
+ test_when_finished "rm -fr selective" &&
+ git clone super selective &&
+ (
+ cd selective &&
+ git submodule init submodule &&
+ git submodule update 2>err &&
+ test_path_exists submodule/.git &&
+ test_path_is_missing rebasing/.git &&
+ ! grep "Submodule path .* not initialized" err
+ )
+
+'
+
test_expect_success 'submodule update continues after checkout error' '
(cd super &&
git reset --hard HEAD &&
next prev parent reply other threads:[~2022-04-25 20:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-24 6:26 [PATCH] submodule--helper: fix initialization of warn_if_uninitialized Orgad Shaneh via GitGitGadget
2022-04-25 9:34 ` Junio C Hamano
2022-04-25 12:43 ` Orgad Shaneh
2022-04-25 12:45 ` [PATCH v2] " Orgad Shaneh via GitGitGadget
2022-04-25 18:25 ` Junio C Hamano
2022-04-25 20:56 ` Junio C Hamano [this message]
2022-04-27 22:22 ` Glen Choo
2022-04-27 22:23 ` Glen Choo
2022-04-27 22:25 ` Glen Choo
2022-04-27 22:19 ` Glen Choo
2022-04-27 23:20 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqtuagvq4n.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=chooglen@google.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=orgads@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).