{"thread":{"id":"17550","subject":"[PATCH 1/3] Missing && in t/t7001.sh.","startedAt":"2009-02-04T09:32:06Z","lastAt":"2009-02-04T20:54:19Z","messageCount":4,"participants":["Matthieu Moy","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"103098","messageId":"1233739928-19895-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"17550","inReplyTo":null,"subject":"[PATCH 1/3] Missing && in t/t7001.sh.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2009-02-04T09:32:06Z","receivedAt":"2009-02-04T09:32:06Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Without this, the exit status is only the one of the last line.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n t/t7001-mv.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t7001-mv.sh b/t/t7001-mv.sh\nindex ef2e78f..e4dfe95 100755\n--- a/t/t7001-mv.sh\n+++ b/t/t7001-mv.sh\n@@ -55,7 +55,7 @@ test_expect_success \\\n      git mv -k untracked1 untracked2 path0 &&\n      test -f untracked1 &&\n      test -f untracked2 &&\n-     test ! -f path0/untracked1\n+     test ! -f path0/untracked1 &&\n      test ! -f path0/untracked2'\n \n # clean up the mess in case bad things happen\n-- \n1.6.1.2.321.g68da9\n"},{"id":"103100","messageId":"1233739928-19895-2-git-send-email-Matthieu.Moy@imag.fr","threadId":"17550","inReplyTo":"1233739928-19895-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 2/3] [BUG] Add a testcase for \"git mv -f\" on untracked files.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2009-02-04T09:32:07Z","receivedAt":"2009-02-04T09:32:07Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"This currently fails with:\ngit: builtin-mv.c:217: cmd_mv: Assertion `pos >= 0' failed.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n t/t7001-mv.sh |    8 ++++++++\n 1 files changed, 8 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t7001-mv.sh b/t/t7001-mv.sh\nindex e4dfe95..52a47b5 100755\n--- a/t/t7001-mv.sh\n+++ b/t/t7001-mv.sh\n@@ -58,6 +58,14 @@ test_expect_success \\\n      test ! -f path0/untracked1 &&\n      test ! -f path0/untracked2'\n \n+test_expect_failure \\\n+    'checking -f on untracked file with existing target' \\\n+    'touch path0/untracked1 &&\n+     git mv -f untracked1 path0\n+     test ! -f .git/index.lock &&\n+     test -f untracked1 &&\n+     test -f path0/untracked1'\n+\n # clean up the mess in case bad things happen\n rm -f idontexist untracked1 untracked2 \\\n      path0/idontexist path0/untracked1 path0/untracked2 \\\n-- \n1.6.1.2.321.g68da9\n"},{"id":"103099","messageId":"1233739928-19895-3-git-send-email-Matthieu.Moy@imag.fr","threadId":"17550","inReplyTo":"1233739928-19895-2-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 3/3] builtin-mv.c: check for unversionned files before looking at the destination.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2009-02-04T09:32:08Z","receivedAt":"2009-02-04T09:32:08Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"The previous code was failing in the case where one moves an\nunversionned file to an existing destination, with mv -f: the\n\"existing destination\" was checked first, and the error was cancelled\nby the force flag.\n\nWe now check the unrecoverable error first, which fixes the bug.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n builtin-mv.c  |    8 ++++----\n t/t7001-mv.sh |    2 +-\n 2 files changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin-mv.c b/builtin-mv.c\nindex bce9959..01270fe 100644\n--- a/builtin-mv.c\n+++ b/builtin-mv.c\n@@ -162,7 +162,9 @@ int cmd_mv(int argc, const char **argv, const char *prefix)\n \t\t\t\t}\n \t\t\t\targc += last - first;\n \t\t\t}\n-\t\t} else if (lstat(dst, &st) == 0) {\n+\t\t} else if (cache_name_pos(src, length) < 0)\n+\t\t\tbad = \"not under version control\";\n+\t\telse if (lstat(dst, &st) == 0) {\n \t\t\tbad = \"destination exists\";\n \t\t\tif (force) {\n \t\t\t\t/*\n@@ -177,9 +179,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)\n \t\t\t\t} else\n \t\t\t\t\tbad = \"Cannot overwrite\";\n \t\t\t}\n-\t\t} else if (cache_name_pos(src, length) < 0)\n-\t\t\tbad = \"not under version control\";\n-\t\telse if (string_list_has_string(&src_for_dst, dst))\n+\t\t} else if (string_list_has_string(&src_for_dst, dst))\n \t\t\tbad = \"multiple sources for the same target\";\n \t\telse\n \t\t\tstring_list_insert(dst, &src_for_dst);\ndiff --git a/t/t7001-mv.sh b/t/t7001-mv.sh\nindex 52a47b5..8fb3a56 100755\n--- a/t/t7001-mv.sh\n+++ b/t/t7001-mv.sh\n@@ -58,7 +58,7 @@ test_expect_success \\\n      test ! -f path0/untracked1 &&\n      test ! -f path0/untracked2'\n \n-test_expect_failure \\\n+test_expect_success \\\n     'checking -f on untracked file with existing target' \\\n     'touch path0/untracked1 &&\n      git mv -f untracked1 path0\n-- \n1.6.1.2.321.g68da9\n"},{"id":"103204","messageId":"7vocxhord0.fsf@gitster.siamese.dyndns.org","threadId":"17550","inReplyTo":"1233739928-19895-3-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH 3/3] builtin-mv.c: check for unversionned files before looking at the destination.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-04T20:54:19Z","receivedAt":"2009-02-04T20:54:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Makes sense; thanks.\n"}]}