git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: filter-branch IO optimization

From
Jeff King <peff@peff.net>
Date
Oct 12, 2012, 17:20 UTC
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:
Show 15 quoted lines
> > 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
Previous: Enrico Weigelt
Message 7 of 7 in “filter-branch IO optimization”
  1. Enrico WeigeltOct 11, 2012
  2. Johannes SixtOct 11, 2012
  3. Thomas RastOct 11, 2012
  4. Enrico WeigeltOct 12, 2012
  5. Enrico WeigeltOct 12, 2012
  6. Enrico WeigeltOct 12, 2012
  7. Jeff KingOct 12, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.