diff options
author | 2012-10-14 02:57:32 -0700 | |
---|---|---|
committer | 2012-10-16 13:28:49 -0700 | |
commit | 09d374560a6dc0d364668264fe2640ffc6e193d6 (patch) | |
tree | 476cf2e7fc7a7aba3eade27b595a58ed1c89c134 /create-git.sh | |
parent | add usable script (diff) | |
download | git-conversion-tools-09d374560a6dc0d364668264fe2640ffc6e193d6.tar.gz git-conversion-tools-09d374560a6dc0d364668264fe2640ffc6e193d6.tar.bz2 git-conversion-tools-09d374560a6dc0d364668264fe2640ffc6e193d6.zip |
Ongoing mangling
Diffstat (limited to 'create-git.sh')
-rwxr-xr-x | create-git.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/create-git.sh b/create-git.sh new file mode 100755 index 0000000..6389024 --- /dev/null +++ b/create-git.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +proc_count=$(grep -c MHz /proc/cpuinfo) +[ ${proc_count} -eq 0 ] && proc_count=1 +root="$(pwd)" +mkdir -p git +rm -rf git/* git/.git +set -f +mkdir -p git +cd git +git init --bare +git config core.logAllRefUpdates false +git config prune.expire now +mkdir -p objects/info +targets=( $(find ../final/ -maxdepth 1 -mindepth 1 -printf '../final/%P/\n' | \ + xargs -n1 readlink -f | tee >(sed -e 's:$:/git/objects:' > objects/info/alternates) ) ) +for x in "${targets[@]}"; do + rev=$(git --git-dir $x/git rev-list -1 master 2> /dev/null) + [ -z "$rev" ] && { echo "no content: $x"; continue; } + x="refs/heads/source/$(basename $x)" + git update-ref "$x" $rev +done + +echo "linearizing history, and rewriting messages..." + +time ( + git fast-export --progress=1000 --all --reverse --date-order --no-data | \ + tee ../export-stream-raw | \ + "${root}/rewrite-commit-dump.py" | \ + tee ../export-stream-rewritten | \ + git fast-import +) 2>&1 | tee git-creation.log + +echo "recomposed; repacking and breaking alternate linkage..." +# Wipe the strong refs to the other repos... +git ls-remote . refs/heads/source/'*' | awk '{print $2;}' | xargs -n1 git update-ref -d +# Localize the content... +time git repack -Adf --window=100 --depth=100 +# Wipe the alternates. +rm objects/info/alternates +echo "doing cleanup..." +time git prune +echo "doing basic sanity check" +time git log -p refs/heads/master > /dev/null || echo "non zero exit code from git log run..." +echo "Done" |