{"thread":{"id":"35470","subject":"git filter-branch --directory-filter oddity","startedAt":"2013-12-03T22:44:40Z","lastAt":"2013-12-04T22:48:26Z","messageCount":3,"participants":["Martin Langhoff"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"231475","messageId":"CACPiFC+nCj8VMqb+aK-C5gMyX6R0dDba1U1U49KTktF3WDQ9ZA@mail.gmail.com","threadId":"35470","inReplyTo":null,"subject":"git filter-branch --directory-filter oddity","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2013-12-03T22:44:40Z","receivedAt":"2013-12-03T22:44:40Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"When using git filter-branch --prune-empty --directory-filter foo/bar\nto extract the history of the foo/bar directory, I am getting a very\nstrange result.\n\nDirectory foo/bar is \"slow moving\". Say, 22 commits out of several\nthousand. I would like to extract just those 22 commits.\n\nInstead, I get ~1500 commits, which seem to have not been skipped\nbecause they are merge commits. Merges completely immaterial to this\ndirectory.\n\nAs they have not been skipped, they are fully fleshed out. By this, I\nmean that we have the whole tree in place. So these 22 commits appear\nwith foo/bar pulled out to the root of the project, in the midst of\n1500 commits with a full tree.\n\nThe commit diffs make no sense what-so-ever.\n\nAm I doing it wrong?\n\n\n\nm\n-- \n martin.langhoff@gmail.com\n -  ask interesting questions\n - don't get distracted with shiny stuff  - working code first\n ~ http://docs.moodle.org/en/User:Martin_Langhoff\n"},{"id":"231476","messageId":"CACPiFCLY+nS1S=-x6WA4wHJtMcAf_ks18b6YVhiJjJSZtRKK7g@mail.gmail.com","threadId":"35470","inReplyTo":"CACPiFC+nCj8VMqb+aK-C5gMyX6R0dDba1U1U49KTktF3WDQ9ZA@mail.gmail.com","subject":"Re: git filter-branch --directory-filter oddity","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2013-12-03T22:58:45Z","receivedAt":"2013-12-03T22:58:45Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On Tue, Dec 3, 2013 at 5:44 PM, Martin Langhoff\n<martin.langhoff@gmail.com> wrote:\n> As they have not been skipped, they are fully fleshed out. By this, I\n> mean that we have the whole tree in place. So these 22 commits appear\n> with foo/bar pulled out to the root of the project, in the midst of\n> 1500 commits with a full tree.\n\nIOWs, I am experimenting with something like:\n\ngit filter-branch -f -d /tmp/moodle-$RANDOM --prune-empty\n--index-filter \"git ls-files -z | grep -zZ -v '${dirpath}'  | xargs -0\n--no-run-if-empty -n100 git rm --quiet --cached --ignore-unmatch \"\n^v2.1.0 $branches\ngit filter-branch -f --prune-empty --subdirectory-filter ${dirpath}\n^v2.1.0 $branches\ngit filter-branch -f --commit-filter\n\"~/src/git-filter-branch-tools/remove-pointless-commit.rb \\\"\\$@\\\"\"\n^v2.1.0 $branches\n\nperhaps the docs for filter-branch imply, to me at least, that it's a\nDWIM tool. I am surprised at having to roll my own on something that\nis fairly popular.\n\ncheers,\n\n\n\nm\n-- \n martin.langhoff@gmail.com\n -  ask interesting questions\n - don't get distracted with shiny stuff  - working code first\n ~ http://docs.moodle.org/en/User:Martin_Langhoff\n"},{"id":"231553","messageId":"CACPiFCJQeK7+8Ob23HPrzhoSwuTiHdaz8NYhhn2ki-egzJT6dQ@mail.gmail.com","threadId":"35470","inReplyTo":"CACPiFC+nCj8VMqb+aK-C5gMyX6R0dDba1U1U49KTktF3WDQ9ZA@mail.gmail.com","subject":"Re: git filter-branch --directory-filter oddity","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2013-12-04T22:48:26Z","receivedAt":"2013-12-04T22:48:26Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On Tue, Dec 3, 2013 at 5:44 PM, Martin Langhoff\n<martin.langhoff@gmail.com> wrote:\n> Am I doing it wrong?\n\nLooks like I was doing something wrong. Apologies about the noise.\n\ncheers,\n\n\n\nm\n-- \n martin.langhoff@gmail.com\n -  ask interesting questions\n - don't get distracted with shiny stuff  - working code first\n ~ http://docs.moodle.org/en/User:Martin_Langhoff\n"}]}