summaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/submodule.c b/submodule.c
index 0998ea2..6e14547 100644
--- a/submodule.c
+++ b/submodule.c
@@ -517,8 +517,8 @@ static void show_submodule_header(struct diff_options *o, const char *path,
* Attempt to lookup the commit references, and determine if this is
* a fast forward or fast backwards update.
*/
- *left = lookup_commit_reference(one);
- *right = lookup_commit_reference(two);
+ *left = lookup_commit_reference(the_repository, one);
+ *right = lookup_commit_reference(the_repository, two);
/*
* Warn about missing commits in the submodule project, but only if
@@ -1534,6 +1534,18 @@ out:
return ret;
}
+void submodule_unset_core_worktree(const struct submodule *sub)
+{
+ char *config_path = xstrfmt("%s/modules/%s/config",
+ get_git_common_dir(), sub->name);
+
+ if (git_config_set_in_file_gently(config_path, "core.worktree", NULL))
+ warning(_("Could not unset core.worktree setting in submodule '%s'"),
+ sub->path);
+
+ free(config_path);
+}
+
static const char *get_super_prefix_or_empty(void)
{
const char *s = get_super_prefix();
@@ -1670,7 +1682,7 @@ int submodule_move_head(const char *path,
argv_array_push(&cp.args, new_head ? new_head : empty_tree_oid_hex());
if (run_command(&cp)) {
- ret = -1;
+ ret = error(_("Submodule '%s' could not be updated."), path);
goto out;
}
@@ -1699,6 +1711,8 @@ int submodule_move_head(const char *path,
if (is_empty_dir(path))
rmdir_or_warn(path);
+
+ submodule_unset_core_worktree(sub);
}
}
out: