mv: let 'git mv file no-such-dir/' error out
commitc57f6281ff847db7094d708f5c5b939d378f7120
authorMatthieu Moy <Matthieu.Moy@imag.fr>
Tue, 3 Dec 2013 08:32:04 +0000 (3 09:32 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 4 Dec 2013 19:49:15 +0000 (4 11:49 -0800)
tree9081a84d096cf120be9551464cbba2f0c871b777
parenta155a5f075cdc09e584a58d68bdce0c80e6c4b5a
mv: let 'git mv file no-such-dir/' error out

Git used to trim the trailing slash, and make the command equivalent
to 'git mv file no-such-dir', which created the file no-such-dir
(while the trailing slash explicitly stated that it could only be a
directory).

This patch skips the trailing slash removal for the destination
path.  The path with its trailing slash is passed to rename(2),
which errors out with the appropriate message:

  $ git mv file no-such-dir/
  fatal: renaming 'file' failed: Not a directory

Original-patch-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/mv.c
t/t7001-mv.sh