From: Jeff King Date: Fri, 12 Oct 2012 17:20:36 GMT Subject: Re: filter-branch IO optimization Message-ID: <20121012172036.GB21409@sigill.intra.peff.net> In-Reply-To: <9de87aac-7e15-48d9-832a-e9a030c5ed43@zcs> On Fri, Oct 12, 2012 at 04:49:54PM +0200, Enrico Weigelt wrote: > > The usual advice is "use an index-filter instead". It's *much* > > faster > > than a tree filter. However: > > I've tried the last example from git-filter-branch manpage, but failed. > Seems like the GIT_INDEX_FILE env variable doesnt get honoured by > git-update-index, no index.new file created, and so mv call fails. > > My second try (as index-filter command) was: > > git ls-files -s > ../_INDEX_TMP > cat ../_INDEX_TMP | > sed "s-\t\"*-&addons/-" | > git update-index --index-info > rm -f ../_INDEX_TMP I didn't look closely at your individual problem, but that example has proven flaky before. There were some simpler formulations given in this thread: http://thread.gmane.org/gmane.comp.version-control.git/195492 In particular, Junio suggested: git filter-branch --index-filter ' rm -f "$GIT_INDEX_FILE" git read-tree --prefix=newsubdir/ "$GIT_COMMIT" ' HEAD -Peff