{"thread":{"id":"5318","subject":"Another git-mv bug","startedAt":"2006-08-18T07:23:28Z","lastAt":"2006-08-18T10:42:39Z","messageCount":2,"participants":["Fredrik Kuivinen","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"25528","messageId":"20060818072328.GA5255@c165.ib.student.liu.se","threadId":"5318","inReplyTo":null,"subject":"Another git-mv bug","fromName":"Fredrik Kuivinen","fromEmail":"freku045@student.liu.se","sentAt":"2006-08-18T07:23:28Z","receivedAt":"2006-08-18T07:23:28Z","isPatch":false,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"Hi,\n\nIn a Git repository:\n\n    $ git mv templates/info--exclude .\n    fatal: renaming templates/info--exclude failed: No such file or directory\n\n- Fredrik\n"},{"id":"25541","messageId":"Pine.LNX.4.63.0608181241200.28360@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"5318","inReplyTo":"20060818072328.GA5255@c165.ib.student.liu.se","subject":"[PATCH] git-mv: special case destination \".\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-08-18T10:42:39Z","receivedAt":"2006-08-18T10:42:39Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nSince the normalized basename of \".\" is \"\", the check for directory\nfailed erroneously.\n\nNoticed by Fredrik Kuivinen.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n\n---\n\n\t> Subject: Re: Another git-mv bug\n\n\t... and another fix.\n\n\tOn Fri, 18 Aug 2006, Fredrik Kuivinen wrote:\n\n\t> In a Git repository:\n\t> \n\t>     $ git mv templates/info--exclude .\n\t>     fatal: renaming templates/info--exclude failed: No such file or directory\n\n builtin-mv.c  |    5 ++++-\n t/t7001-mv.sh |    4 ++++\n 2 files changed, 8 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-mv.c b/builtin-mv.c\nindex c0c8764..b2ecc26 100644\n--- a/builtin-mv.c\n+++ b/builtin-mv.c\n@@ -114,7 +114,10 @@ int cmd_mv(int argc, const char **argv, \n \tmodes = xcalloc(count, sizeof(enum update_mode));\n \tdest_path = copy_pathspec(prefix, argv + argc - 1, 1, 0);\n \n-\tif (!lstat(dest_path[0], &st) &&\n+\tif (dest_path[0][0] == '\\0')\n+\t\t/* special case: \".\" was normalized to \"\" */\n+\t\tdestination = copy_pathspec(dest_path[0], argv + i, count, 1);\n+\telse if (!lstat(dest_path[0], &st) &&\n \t\t\tS_ISDIR(st.st_mode)) {\n \t\tdest_path[0] = add_slash(dest_path[0]);\n \t\tdestination = copy_pathspec(dest_path[0], argv + i, count, 1);\ndiff --git a/t/t7001-mv.sh b/t/t7001-mv.sh\nindex e5e0bb9..b7fcdb3 100755\n--- a/t/t7001-mv.sh\n+++ b/t/t7001-mv.sh\n@@ -82,4 +82,8 @@ test_expect_failure \\\n     'do not move directory over existing directory' \\\n     'mkdir path0 && mkdir path0/path2 && git-mv path2 path0'\n \n+test_expect_success \\\n+    'move into \".\"' \\\n+    'git-mv path1/path2/ .'\n+\n test_done\n-- \n1.4.2.ge0502-dirty\n"}]}