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

Re: filter-branch IO optimization

From
Enrico Weigelt <enrico.weigelt@vnc.biz>
Date
Oct 12, 2012, 17:20 UTC
Message-ID
<b94baafd-3813-49c6-9848-97bf11960bb9@zcs>
In-Reply-To
<d4a00074-5134-4314-aa61-f222f41712bb@zcs>
Hi folks,

now finally managed the index-filter part. The main problem, IIRC, was that git-update-index didn't automatically create an empty index, so I needed to explicitly copy in (manually created it with an empty repo).

My current filter code is:
if [ ! "$GIT_AUTHOR_EMAIL" ] && [ ! "$GIT_COMMITTER_EMAIL" ]; then
	export GIT_AUTHOR_EMAIL="nobody@none.org"
	export GIT_COMMITTER_NAME="nobody@none.org"
elif [ ! "$GIT_AUTHOR_EMAIL" ]; then
	export GIT_AUTHOR_EMAIL="$GIT_COMMITTER_EMAIL"
elif [ ! "$GIT_COMITTER_EMAIL" ]; then
	export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_NAME"
fi
if [ ! "$GIT_AUTHOR_NAME" ] && [ ! "$GIT_COMMITTER_NAME" ]; then
	export GIT_AUTHOR_NAME="nobody@none.org"
	export GIT_COMMITTER_NAME="nobody@none.org"
elif [ ! "$GIT_AUTHOR_NAME" ]; then
	export GIT_AUTHOR_NAME="$GIT_COMMITTER_NAME"
elif [ ! "$GIT_COMITTER_NAME" ]; then
	export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
fi
cp ../../../../scripts/index.empty $GIT_INDEX_FILE.new
git ls-files -s |
    sed "s-\t\"*-&addons/-" |
    grep -e "\t*addons/$module" |
    ( export GIT_INDEX_FILE=$GIT_INDEX_FILE.new ; git update-index --index-info )
mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE

Now another problem: this leaves behind thousands of now empty merge nodes (--prune-empty doesnt seem to catch them all), so I loop through additional `git filter-branch --prune-empty` runs, until the ref remains unchanged.

This process is even more time-consuming, as it takes really many passes (havent counted them yet).

Does anyone have an idea, why a single run doesnt catch that all?
cu
Previous: Enrico WeigeltNext: Jeff King
Message 6 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.