Subject: Re: filter-branch performance

From: Jeff King <[email-masked]>
Date: Wed, 10 Dec 2014 09:37:07 -0500

On Wed, Dec 10, 2014 at 02:18:24PM +0000, Roberto Tyley wrote:

> Depending on how much time you can sink into improving the performance
> (versus just allowing the process to run to completion), you could
> also look into a non-forking solution, as well as not bothering to
> load the commit trees. To me non-forking means putting everything into
> the JVM by using JGit, like the BFG does, though libgit2 might also be
> an option.
> 
> Changing the BFG's code to do the transformation in your script is
> absolutely trivial - define a commit-node cleaner like this:
> 
> object SetCommitterToAuthor extends CommitNodeCleaner {
>   override def fixer(kit: CommitNodeCleaner.Kit) = c =>
> c.copy(committer = c.author) // PersonIdent class holds name, email &
> time
> }

Thanks. I _almost_ mentioned BFG in the original email, but I didn't
think it could do arbitrary fixes like this. Can you monkey-patch in
arbitrary code, or do you have to rebuild all of BFG to include the
snippet above?

> ...trivial if you don't mind compiling Scala with SBT that is, and I'm
> sure some people do! A DSL for non-Scala people to define their own
> BFG scripts would be good, I must get on that some day.

That would be cool.  Even if the DSL was just Java, if you could do
something like:

  vi fix.java
  javac fix.java
  bfg --filter=fix.class

that would be very useful (and I am probably showing my lack of Java chops
by getting the compilation command or filenames wrong :) ).

> I started running the same test some time ago using filter-branch,
> unfortunately that test has not completed yet - the BFG appears to be
> substantially faster.

No fair if you didn't run filter-branch on a PC and BFG on a Raspberry
Pi. You have to give us a fighting chance. :)

-Peff