Skip to content

Commit 97cb977

Browse files
chooglengitster
authored andcommitted
submodule--helper: remove ensure-core-worktree
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 29a5e9e commit 97cb977

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

builtin/submodule--helper.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2783,17 +2783,11 @@ static int push_check(int argc, const char **argv, const char *prefix)
27832783
return 0;
27842784
}
27852785

2786-
static int ensure_core_worktree(int argc, const char **argv, const char *prefix)
2786+
static void ensure_core_worktree(const char *path)
27872787
{
2788-
const char *path;
27892788
const char *cw;
27902789
struct repository subrepo;
27912790

2792-
if (argc != 2)
2793-
BUG("submodule--helper ensure-core-worktree <path>");
2794-
2795-
path = argv[1];
2796-
27972791
if (repo_submodule_init(&subrepo, the_repository, path, null_oid()))
27982792
die(_("could not get a repository handle for submodule '%s'"), path);
27992793

@@ -2813,8 +2807,6 @@ static int ensure_core_worktree(int argc, const char **argv, const char *prefix)
28132807
free(abs_path);
28142808
strbuf_release(&sb);
28152809
}
2816-
2817-
return 0;
28182810
}
28192811

28202812
static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
@@ -3041,6 +3033,7 @@ static int module_create_branch(int argc, const char **argv, const char *prefix)
30413033
/* NEEDSWORK: this is a temporary name until we delete update_submodule() */
30423034
static int update_submodule2(struct update_data *update_data)
30433035
{
3036+
ensure_core_worktree(update_data->sm_path);
30443037
if (update_data->just_cloned)
30453038
oidcpy(&update_data->suboid, null_oid());
30463039
else if (resolve_gitlink_ref(update_data->sm_path, "HEAD", &update_data->suboid))
@@ -3459,7 +3452,6 @@ static struct cmd_struct commands[] = {
34593452
{"add", module_add, SUPPORT_SUPER_PREFIX},
34603453
{"update-clone", update_clone, 0},
34613454
{"run-update-procedure", run_update_procedure, 0},
3462-
{"ensure-core-worktree", ensure_core_worktree, 0},
34633455
{"relative-path", resolve_relative_path, 0},
34643456
{"resolve-relative-url-test", resolve_relative_url_test, 0},
34653457
{"foreach", module_foreach, SUPPORT_SUPER_PREFIX},

git-submodule.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,6 @@ cmd_update()
385385
do
386386
die_if_unmatched "$quickabort" "$sha1"
387387

388-
git submodule--helper ensure-core-worktree "$sm_path" || exit 1
389-
390388
displaypath=$(git submodule--helper relative-path "$prefix$sm_path" "$wt_prefix")
391389

392390
if test $just_cloned -eq 0

0 commit comments

Comments
 (0)