Skip to content

Commit e441966

Browse files
chooglengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1a0b78c commit e441966

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

builtin/submodule--helper.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2594,9 +2594,6 @@ static int run_update_procedure(int argc, const char **argv, const char *prefix)
25942594
OPT_CALLBACK_F(0, "oid", &update_data.oid, N_("sha1"),
25952595
N_("SHA1 expected by superproject"), PARSE_OPT_NONEG,
25962596
parse_opt_object_id),
2597-
OPT_CALLBACK_F(0, "suboid", &update_data.suboid, N_("subsha1"),
2598-
N_("SHA1 of submodule's HEAD"), PARSE_OPT_NONEG,
2599-
parse_opt_object_id),
26002597
OPT_END()
26012598
};
26022599

@@ -3032,6 +3029,12 @@ static int module_create_branch(int argc, const char **argv, const char *prefix)
30323029
/* NEEDSWORK: this is a temporary name until we delete update_submodule() */
30333030
static int update_submodule2(struct update_data *update_data)
30343031
{
3032+
if (update_data->just_cloned)
3033+
oidcpy(&update_data->suboid, null_oid());
3034+
else if (resolve_gitlink_ref(update_data->sm_path, "HEAD", &update_data->suboid))
3035+
die(_("Unable to find current revision in submodule path '%s'"),
3036+
update_data->displaypath);
3037+
30353038
if (!oideq(&update_data->oid, &update_data->suboid) || update_data->force)
30363039
return do_run_update_procedure(update_data);
30373040

git-submodule.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -406,14 +406,9 @@ cmd_update()
406406

407407
displaypath=$(git submodule--helper relative-path "$prefix$sm_path" "$wt_prefix")
408408

409-
if test $just_cloned -eq 1
409+
if test $just_cloned -eq 0
410410
then
411-
subsha1=
412-
else
413411
just_cloned=
414-
subsha1=$(sanitize_submodule_env; cd "$sm_path" &&
415-
git rev-parse --verify HEAD) ||
416-
die "fatal: $(eval_gettext "Unable to find current revision in submodule path '\$displaypath'")"
417412
fi
418413

419414
if test -n "$remote"
@@ -441,7 +436,6 @@ cmd_update()
441436
${update:+--update "$update"} \
442437
${prefix:+--recursive-prefix "$prefix"} \
443438
${sha1:+--oid "$sha1"} \
444-
${subsha1:+--suboid "$subsha1"} \
445439
"--" \
446440
"$sm_path")
447441

0 commit comments

Comments
 (0)