summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/mv.c3
-rwxr-xr-xt/t7001-mv.sh6
2 files changed, 7 insertions, 2 deletions
diff --git a/builtin/mv.c b/builtin/mv.c
index cf3684d907..8ce6a2ddd4 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -286,8 +286,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
pos = cache_name_pos(src, strlen(src));
assert(pos >= 0);
- if (!show_only)
- rename_cache_entry_at(pos, dst);
+ rename_cache_entry_at(pos, dst);
}
if (gitmodules_modified)
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 6e5031f56f..d4e6485a26 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -39,6 +39,12 @@ test_expect_success \
grep "^R100..*path1/COPYING..*path0/COPYING"'
test_expect_success \
+ 'mv --dry-run does not move file' \
+ 'git mv -n path0/COPYING MOVED &&
+ test -f path0/COPYING &&
+ test ! -f MOVED'
+
+test_expect_success \
'checking -k on non-existing file' \
'git mv -k idontexist path0'