diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-04-29 12:59:07 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-04-29 12:59:07 -0700 |
commit | 9cb50a3ca60a5c5969deb83d11782da26c3bcdb7 (patch) | |
tree | 5c5454be5348508477696ae56cb01f6aa92f6467 /builtin | |
parent | Merge branch 'nd/test-helpers' (diff) | |
parent | mv: allow moving nested submodules (diff) | |
download | tgif-9cb50a3ca60a5c5969deb83d11782da26c3bcdb7.tar.xz |
Merge branch 'sb/mv-submodule-fix'
"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) |