{"thread":{"id":"29123","subject":"Bug in filter-branch example for moving into a subdirectory","startedAt":"2011-12-10T00:07:49Z","lastAt":"2011-12-10T00:07:49Z","messageCount":1,"participants":["Jesse Keating"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"180735","messageId":"BD3976C6-7F37-40EF-9FB1-CF55828A807D@redhat.com","threadId":"29123","inReplyTo":null,"subject":"Bug in filter-branch example for moving into a subdirectory","fromName":"Jesse Keating","fromEmail":"jkeating@redhat.com","sentAt":"2011-12-10T00:07:49Z","receivedAt":"2011-12-10T00:07:49Z","isPatch":false,"sender":{"key":"jkeating@redhat.com","avatar":null},"body":"I ran into a bug with the example in the man page for filter-branch, for moving everything into a subdir:\n\n           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\nThe problem seems to be when a commit happens that is just a file removal with no added file.  In those cases, git ls-files doesn't output anything.  Trying to throw a -d option in doesn't seem to improve matters.\n\nSo the problem is that if a commit is just file removals, this example will actually crash.  Unfortunately I don't have a suggested solution at the moment.\n\n--\nJesse Keating\nFedora -- Freedom² is a feature!\nidenti.ca: http://identi.ca/jkeating\n"}]}