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