Re: [PATCH] git-filter-branch: add --egrep-filter option
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Apr 16, 2011, 08:16 UTC
- Message-ID
- <201104161016.51690.j6t@kdbg.org>
- In-Reply-To
- <4DA8CBB0.6080103@rivulet.ca>
On Samstag, 16. April 2011, Michael O'Cleirigh wrote:
Show 16 quoted lines
> The --subdirectory-filter will look for a single directory and then rewrite > history to make its content the root. This is ok except for cases where we > want to retain history of those files before they were moved into that > directory. > > The --egrep-filter option allows specifying an egrep regex for the files in > the tree of each commit to keep. For example: > > Directories we want are A, B, C, D and they exist in several different > lifetimes. A and B exist sometimes together then B and C and finally then > D. > > e.g. git-filter-branch --egrep-filter "(A|B|C|D)" > > Each commit will then contain different combination's of A or B or C or D > (up to A and B and C and D).
Why do you need a new --...-filter option for this? Your implementation is merely an instance of an --index-filter, and at that a very specialized one, which operates only at the top-most directory level.
> + git ls-tree $commit | egrep "$filter_egrep" | git mktree |
xargs git read-tree -i -m
-- Hannes