3 # Use this tool to rewrite your .git/remotes/ files into the config.
 
   7 if [ -d "$GIT_DIR"/remotes ]; then
 
   8         echo "Rewriting $GIT_DIR/remotes" >&2
 
  14                         name=$(printf "$f" | tr -c "A-Za-z0-9-" ".")
 
  16                         -e "s/^URL:[    ]*\(.*\)$/remote.$name.url \1 ./p" \
 
  17                         -e "s/^Pull:[   ]*\(.*\)$/remote.$name.fetch \1 ^$ /p" \
 
  18                         -e "s/^Push:[   ]*\(.*\)$/remote.$name.push \1 ^$ /p" \
 
  22         } | while read key value regex; do
 
  25                         if [ $error = 0 ]; then
 
  26                                 mv "$GIT_DIR"/remotes "$GIT_DIR"/remotes.old
 
  29                         echo "git config $key "$value" $regex"
 
  30                         git config $key "$value" $regex || error=1 ;;