return ret;
}
+static void validate_no_submodules(const struct worktree *wt)
+{
+ struct index_state istate = { NULL };
+ int i, found_submodules = 0;
+
+ if (read_index_from(&istate, worktree_git_path(wt, "index")) > 0) {
+ for (i = 0; i < istate.cache_nr; i++) {
+ struct cache_entry *ce = istate.cache[i];
+
+ if (S_ISGITLINK(ce->ce_mode)) {
+ found_submodules = 1;
+ break;
+ }
+ }
+ }
+ discard_index(&istate);
+
+ if (found_submodules)
+ die(_("working trees containing submodules cannot be moved"));
+}
+
static int move_worktree(int ac, const char **av, const char *prefix)
{
struct option options[] = {
if (file_exists(dst.buf))
die(_("target '%s' already exists"), dst.buf);
+ validate_no_submodules(wt);
+
reason = is_worktree_locked(wt);
if (reason) {
if (*reason)