Re: [PATCH 1/2] add setup step to filter-branch
From: Junio C Hamano <hidden>
Date: 2017-06-09 13:11:47
Jeff King [off-list ref] writes:
I have a feeling that if we were ever to rewrite filter-branch, it would probably be worth allowing people to write snippets in a better language (possibly even a domain-specific language). I'm sure that most of the program being written in shell doesn't help, but if we're spawning one or more shell instances per commit (plus the Git programs they spawn!), it's always going to be slow. But I suspect that would be an uphill battle, as our only stable API involves starting external processes anyway. You'd probably do better to pick a language you like and rewrite it in using libgit2's bindings to that language. It's not feature complete, but basic stuff like "put this entry in the tree" is certainly mature.quoted
*1* The issue is *not* that these individual filter commands expect <command> written as a shell scriptlet; it is that these scriptlets expect to be evaled inside a single shell process, making an update to a shell variable in one command visible to the next command that runs.I think you'd need a shell "helper" that's a single long-running process and just reads "eval the index snippet now" instructions from the C controller. At which point I don't think Andreas's "setup" feature is any harder to support. We just send an "eval the setup snippet" instruction first.
Yes. I do not think this particular one makes things any worse than it already is. As I said, I do not have a strong opinion against the topic; as long as people find the feature useful, I do not mind applying it. Thanks.