summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/checkout.c2
-rw-r--r--submodule.c1
-rw-r--r--unpack-trees.c38
3 files changed, 9 insertions, 32 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 9661e1bcba..246e0cd166 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -858,7 +858,7 @@ static int git_checkout_config(const char *var, const char *value, void *cb)
}
if (starts_with(var, "submodule."))
- return submodule_config(var, value, NULL);
+ return git_default_submodule_config(var, value, NULL);
return git_xmerge_config(var, value, NULL);
}
diff --git a/submodule.c b/submodule.c
index a32043893b..f913c23415 100644
--- a/submodule.c
+++ b/submodule.c
@@ -235,7 +235,6 @@ void load_submodule_cache(void)
return;
gitmodules_config();
- git_config(submodule_config, NULL);
}
static int gitmodules_cb(const char *var, const char *value, void *data)
diff --git a/unpack-trees.c b/unpack-trees.c
index 05335fe5bf..5dce7ff7d4 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -255,28 +255,17 @@ static int check_submodule_move_head(const struct cache_entry *ce,
{
unsigned flags = SUBMODULE_MOVE_HEAD_DRY_RUN;
const struct submodule *sub = submodule_from_ce(ce);
+
if (!sub)
return 0;
if (o->reset)
flags |= SUBMODULE_MOVE_HEAD_FORCE;
- switch (sub->update_strategy.type) {
- case SM_UPDATE_UNSPECIFIED:
- case SM_UPDATE_CHECKOUT:
- if (submodule_move_head(ce->name, old_id, new_id, flags))
- return o->gently ? -1 :
- add_rejected_path(o, ERROR_WOULD_LOSE_SUBMODULE, ce->name);
- return 0;
- case SM_UPDATE_NONE:
- return 0;
- case SM_UPDATE_REBASE:
- case SM_UPDATE_MERGE:
- case SM_UPDATE_COMMAND:
- default:
- warning(_("submodule update strategy not supported for submodule '%s'"), ce->name);
- return -1;
- }
+ if (submodule_move_head(ce->name, old_id, new_id, flags))
+ return o->gently ? -1 :
+ add_rejected_path(o, ERROR_WOULD_LOSE_SUBMODULE, ce->name);
+ return 0;
}
static void reload_gitmodules_file(struct index_state *index,
@@ -293,7 +282,6 @@ static void reload_gitmodules_file(struct index_state *index,
submodule_free();
checkout_entry(ce, state, NULL);
gitmodules_config();
- git_config(submodule_config, NULL);
} else
break;
}
@@ -308,19 +296,9 @@ static void unlink_entry(const struct cache_entry *ce)
{
const struct submodule *sub = submodule_from_ce(ce);
if (sub) {
- switch (sub->update_strategy.type) {
- case SM_UPDATE_UNSPECIFIED:
- case SM_UPDATE_CHECKOUT:
- case SM_UPDATE_REBASE:
- case SM_UPDATE_MERGE:
- /* state.force is set at the caller. */
- submodule_move_head(ce->name, "HEAD", NULL,
- SUBMODULE_MOVE_HEAD_FORCE);
- break;
- case SM_UPDATE_NONE:
- case SM_UPDATE_COMMAND:
- return; /* Do not touch the submodule. */
- }
+ /* state.force is set at the caller. */
+ submodule_move_head(ce->name, "HEAD", NULL,
+ SUBMODULE_MOVE_HEAD_FORCE);
}
if (!check_leading_path(ce->name, ce_namelen(ce)))
return;