summaryrefslogtreecommitdiffstats
path: root/old/MigrateFromGitwebUnixPermToGitolite.sh
blob: 28f420d363a1aa89efef90e8a6b9fbbc46487e09 (plain) (blame)
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
find . -type d -name .git | while read gitdir; do
pushd "$gitdir/../" > /dev/null

name=`dirname "$gitdir"|cut -d / -f 2|cut -d ' ' -f 1`

echo == Entering $name ==

url=$(grep 'url = zx2c4.com:git.zx2c4.com' .git/config | cut -d '=' -f 2 | tr -d ' ')
url=$(echo $url | cut -d ' ' -f 1)

if ! echo $url | grep zx2c4.com > /dev/null; then
	echo "Not a valid zx2c4 ssh repo."
	echo
	popd > /dev/null
	continue
fi

echo $url
scp $url/description .tmpdesc > /dev/null
description=$(cat .tmpdesc)
rm .tmpdesc
echo $description

sed -i -e "s/url = zx2c4.*$/url = gitcode@zx2c4.com:$name/g" .git/config

pushd ~/Projects/gitolite-admin/conf > /dev/null
echo "Writing config.."
(echo
echo "		repo	$name"
echo "		RW+CD	=   zx2c4"
echo "		R	=   @all"
echo "		$name \"Jason A. Donenfeld\" = \"$description\"") >> gitolite.conf
git commit -a -m "Adding $name to repository."
git push
popd > /dev/null

git push --all
git push --tags

echo
popd > /dev/null
done