2006-05-03 15:27:26 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Use this tool to rewrite your .git/remotes/ files into the config.
|
|
|
|
|
|
|
|
. git-sh-setup
|
|
|
|
|
|
|
|
if [ -d "$GIT_DIR"/remotes ]; then
|
|
|
|
echo "Rewriting $GIT_DIR/remotes" >&2
|
|
|
|
error=0
|
|
|
|
# rewrite into config
|
|
|
|
{
|
|
|
|
cd "$GIT_DIR"/remotes
|
|
|
|
ls | while read f; do
|
2007-12-02 20:40:43 +01:00
|
|
|
name=$(printf "$f" | tr -c "A-Za-z0-9-" ".")
|
2006-05-03 15:27:26 +02:00
|
|
|
sed -n \
|
2007-12-02 20:40:43 +01:00
|
|
|
-e "s/^URL:[ ]*\(.*\)$/remote.$name.url \1 ./p" \
|
|
|
|
-e "s/^Pull:[ ]*\(.*\)$/remote.$name.fetch \1 ^$ /p" \
|
|
|
|
-e "s/^Push:[ ]*\(.*\)$/remote.$name.push \1 ^$ /p" \
|
2006-05-03 15:27:26 +02:00
|
|
|
< "$f"
|
|
|
|
done
|
|
|
|
echo done
|
|
|
|
} | while read key value regex; do
|
|
|
|
case $key in
|
|
|
|
done)
|
|
|
|
if [ $error = 0 ]; then
|
|
|
|
mv "$GIT_DIR"/remotes "$GIT_DIR"/remotes.old
|
|
|
|
fi ;;
|
|
|
|
*)
|
2007-07-03 07:52:14 +02:00
|
|
|
echo "git config $key "$value" $regex"
|
|
|
|
git config $key "$value" $regex || error=1 ;;
|
2006-05-03 15:27:26 +02:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
fi
|