{"thread":{"id":"4002","subject":"[PATCH] cg-admin-rewritehist: fix reappearing files with --filter-tree.","startedAt":"2006-04-29T21:45:40Z","lastAt":"2006-04-29T21:45:40Z","messageCount":1,"participants":["Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"19269","messageId":"20060429214540.524C14A5A6@dx.sixt.local","threadId":"4002","inReplyTo":null,"subject":"[PATCH] cg-admin-rewritehist: fix reappearing files with --filter-tree.","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2006-04-29T21:45:40Z","receivedAt":"2006-04-29T21:45:40Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"With --filter-tree a working copy is checked out for each commit.\nHowever, if a file is removed by a commit, the file is _not_ removed\nfrom the working copy by git-checkout-index. This must be done explicitly,\notherwise the file becomes added back again.\n\nSigned-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n\n---\n\n cg-admin-rewritehist |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\n26bb71a2d3d583d9eee10f4e950ff1b7d400e975\ndiff --git a/cg-admin-rewritehist b/cg-admin-rewritehist\nindex 7dd83cf..13ffb5d 100755\n--- a/cg-admin-rewritehist\n+++ b/cg-admin-rewritehist\n@@ -213,10 +213,13 @@ while read commit; do\n \n \tif [ \"$filter_tree\" ]; then\n \t\tgit-checkout-index -f -u -a\n+\t\t# files that $commit removed are now still in the working tree;\n+\t\t# remove them, else they would be added again\n+\t\tgit-ls-files -z --others | xargs -0 rm -f\n \t\teval \"$filter_tree\"\n \t\tgit-diff-index -r $commit | cut -f 2- | tr '\\n' '\\0' | \\\n \t\t\txargs -0 git-update-index --add --replace --remove\n-\t\tgit-ls-files --others | tr '\\n' '\\0' | \\\n+\t\tgit-ls-files -z --others | \\\n \t\t\txargs -0 git-update-index --add --replace --remove\n \tfi\n \n-- \n1.3.1.gaa6b\n"}]}