aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/submodule--helper.c
diff options
context:
space:
mode:
authorGlen Choo <chooglen@google.com>2022-03-04 16:13:52 -0800
committerJunio C Hamano <gitster@pobox.com>2022-03-04 16:39:11 -0800
commite44196659634fdc42672888f5a91e94303052284 (patch)
tree1603e5a372470e6adb3376149eaf507c21b30302 /builtin/submodule--helper.c
parent1a0b78c9537571c18bafc4ac6e3fc16fe6b63c84 (diff)
downloadgit-e44196659634fdc42672888f5a91e94303052284.tar.gz
submodule--helper run-update-procedure: remove --suboid
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 <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/submodule--helper.c')
-rw-r--r--builtin/submodule--helper.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 1b67a3887c..77ca4270f4 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -2594,9 +2594,6 @@ static int run_update_procedure(int argc, const char **argv, const char *prefix)
OPT_CALLBACK_F(0, "oid", &update_data.oid, N_("sha1"),
N_("SHA1 expected by superproject"), PARSE_OPT_NONEG,
parse_opt_object_id),
- OPT_CALLBACK_F(0, "suboid", &update_data.suboid, N_("subsha1"),
- N_("SHA1 of submodule's HEAD"), PARSE_OPT_NONEG,
- parse_opt_object_id),
OPT_END()
};
@@ -3032,6 +3029,12 @@ static int module_create_branch(int argc, const char **argv, const char *prefix)
/* NEEDSWORK: this is a temporary name until we delete update_submodule() */
static int update_submodule2(struct update_data *update_data)
{
+ if (update_data->just_cloned)
+ oidcpy(&update_data->suboid, null_oid());
+ else if (resolve_gitlink_ref(update_data->sm_path, "HEAD", &update_data->suboid))
+ die(_("Unable to find current revision in submodule path '%s'"),
+ update_data->displaypath);
+
if (!oideq(&update_data->oid, &update_data->suboid) || update_data->force)
return do_run_update_procedure(update_data);