blob: 97448ff535f5927891e31bb69467ebc1150c08a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#!/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_root="$(pwd)"
git init --bare
git config core.logAllRefUpdates false
git config prune.expire now
mkdir -p objects/info
update_alternates() {
local alternates="$(readlink -f objects/info)/alternates"
cd "${root}"
while read l; do
l=$(readlink -f "$l")
[ -e "$l/cvs2svn-tmp/git-dump.dat" ] || { echo "ignoring nonexistant alternates source $l" >&2; continue; }
echo "$l/git/objects" >> "${alternates}"
echo "$l"
done
}
standalone_mode() {
find ../final/ -maxdepth 1 -mindepth 1 -printf '../final/%P/\n' | \
xargs -n1 readlink -f | update_alternates
}
if [ "$1" == --fast ]; then
command=update_alternates
else
command=standalone_mode
fi
# Roughly; since alternates are updated as we go- and since rewrite-commit-dump
# doesn't actually output anything till it's linearized the history, we have
# to delay fast-import's startup until we know we have data (meaning linearize
# has finished- thus the alternates are all in place).
# Bit tricky, but the gains have been worth it.
# Regarding the misc cd'ing that occurs- this is to position things where the
# scripts expect to be positions.
time {
${command} | \
( cd "${root}"; ./rewrite-commit-dump.py; ) | \
( read line; { echo "$line"; cat; } | \
tee ../export-stream-rewritten |\
git fast-import
)
} 2>&1 > >(tee git-creation.log)
ret=$?
[ $ret -eq 0 ] || { echo "none zero exit... the hell? $ret"; exit 1; }
echo "recomposed; repacking and breaking alternate linkage..."
# Localize the content we actual use out of the alternates...
time git repack -Adf --window=100 --depth=100
# Wipe the alternates.
rm objects/info/alternates || { echo "no alternates means no sources..."; exit 2; }
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"
|