{"thread":{"id":"39479","subject":"[PATCH] Improved example \"To move the whole tree into a subdirectory...\".","startedAt":"2015-06-01T13:04:15Z","lastAt":"2015-06-01T13:04:15Z","messageCount":1,"participants":["Brett Randall"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"262588","messageId":"CALeEUB57ou3xd85wHb=KVkrHJv2XZc+oeMA3LnNrwPgH_icrkA@mail.gmail.com","threadId":"39479","inReplyTo":null,"subject":"[PATCH] Improved example \"To move the whole tree into a subdirectory...\".","fromName":"Brett Randall","fromEmail":"javabrett@gmail.com","sentAt":"2015-06-01T13:04:15Z","receivedAt":"2015-06-01T13:04:15Z","isPatch":true,"sender":{"key":"javabrett@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1103477?v=4"},"body":"Previously this example would fail if the history contained any empty\ncommit, because the index would not change, and the mv would fail with:\n\nmv: cannot stat <redacted>/index.new': No such file or directory\n\nThe updated example checks whether the index file has been created\nbefore attempting the mv.  The empty commit is retained.\n\nSee\nhttp://stackoverflow.com/questions/7798142/error-combining-git-repositories-into-subdirs\nfor an example and explanation.\n\nSigned-off-by: Brett Randall <javabrett@gmail.com>\n---\n Documentation/git-filter-branch.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-filter-branch.txt\nb/Documentation/git-filter-branch.txt\nindex 73fd9e8..0b9e690 100644\n--- a/Documentation/git-filter-branch.txt\n+++ b/Documentation/git-filter-branch.txt\n@@ -385,7 +385,7 @@ git filter-branch --index-filter \\\n        'git ls-files -s | sed \"s-\\t\\\"*-&newsubdir/-\" |\n                GIT_INDEX_FILE=$GIT_INDEX_FILE.new \\\n                        git update-index --index-info &&\n-        mv \"$GIT_INDEX_FILE.new\" \"$GIT_INDEX_FILE\"' HEAD\n+        if [ -f \"$GIT_INDEX_FILE.new\" ]; then mv\n\"$GIT_INDEX_FILE.new\" \"$GIT_INDEX_FILE\"; fi' HEAD\n ---------------------------------------------------------------\n\n\n-- \n2.3.5\n"}]}