diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-05-18 14:40:05 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-05-18 14:40:05 -0700 |
commit | 920f2ea33bdf06dfda272a146c6fbce2ae11bf99 (patch) | |
tree | fc4130aacbc537752a532878ccb72d9506e164bf /builtin | |
parent | e9ef83a299096d38c557fe71c23a3f3e0b1d1a7f (diff) | |
parent | a127331cd812336235cb95b45b7e4c52c433be7f (diff) | |
download | git-920f2ea33bdf06dfda272a146c6fbce2ae11bf99.tar.gz |
Merge branch 'sb/mv-submodule-fix' into HEAD
"git mv old new" did not adjust the path for a submodule that lives
as a subdirectory inside old/ directory correctly.
* sb/mv-submodule-fix:
mv: allow moving nested submodules
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/mv.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/builtin/mv.c b/builtin/mv.c index aeae855e2b..a2014266b6 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -252,15 +252,18 @@ int cmd_mv(int argc, const char **argv, const char *prefix) int pos; if (show_only || verbose) printf(_("Renaming %s to %s\n"), src, dst); - if (!show_only && mode != INDEX) { - if (rename(src, dst) < 0 && !ignore_errors) - die_errno(_("renaming '%s' failed"), src); - if (submodule_gitfile[i]) { - if (submodule_gitfile[i] != SUBMODULE_WITH_GITDIR) - connect_work_tree_and_git_dir(dst, submodule_gitfile[i]); - if (!update_path_in_gitmodules(src, dst)) - gitmodules_modified = 1; - } + if (show_only) + continue; + if (mode != INDEX && rename(src, dst) < 0) { + if (ignore_errors) + continue; + die_errno(_("renaming '%s' failed"), src); + } + if (submodule_gitfile[i]) { + if (submodule_gitfile[i] != SUBMODULE_WITH_GITDIR) + connect_work_tree_and_git_dir(dst, submodule_gitfile[i]); + if (!update_path_in_gitmodules(src, dst)) + gitmodules_modified = 1; } if (mode == WORKING_DIRECTORY) |