From: Junio C Hamano Date: Mon, 29 May 2017 03:34:41 +0000 (+0900) Subject: Merge branch 'sb/checkout-recurse-submodules' X-Git-Tag: v2.14.0-rc0~170 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f1101cefbd32f7ab8250285f122f132d31ff5335?ds=inline;hp=--cc Merge branch 'sb/checkout-recurse-submodules' "git checkout --recurse-submodules" did not quite work with a submodule that itself has submodules. * sb/checkout-recurse-submodules: submodule: properly recurse for read-tree and checkout submodule: avoid auto-discovery in new working tree manipulator code submodule_move_head: reuse child_process structure for futher commands --- f1101cefbd32f7ab8250285f122f132d31ff5335 diff --cc submodule.c index 54825100b2,b3ae642f29..268f25fc2c --- a/submodule.c +++ b/submodule.c @@@ -1445,16 -1436,9 +1445,16 @@@ int submodule_move_head(const char *pat /* make sure the index is clean as well */ submodule_reset_index(path); } + + if (old && (flags & SUBMODULE_MOVE_HEAD_FORCE)) { + char *gitdir = xstrfmt("%s/modules/%s", + get_git_common_dir(), sub->name); + connect_work_tree_and_git_dir(path, gitdir); + free(gitdir); + } } - prepare_submodule_repo_env_no_git_dir(&cp.env_array); + prepare_submodule_repo_env(&cp.env_array); cp.git_cmd = 1; cp.no_stdin = 1;