gitrefresh

Easily export, reinitialize and update all git repositories in a file hierarchy
git clone git://git.defalsify.org/gitrefresh.git
Info | Log | Files | Refs | README | LICENSE

gitstart.sh (627B)


      1 if [ ! -z $1 ]; then
      2 	pushd $1
      3 fi
      4 
      5 if [ -z "$GITREFRESH_CHECKOUT" ]; then
      6 	gitargs='--mirror'
      7 fi
      8 
      9 while IFS= read -r repo; do
     10 	read -ra parts <<< "$repo"
     11 	url=${parts[0]}
     12 	if [ -z ${parts[1]} ]; then
     13 		basename_raw=$(basename $repo)
     14 		basename_chomped=${basename_raw%.git}
     15 		>&2 echo "checkout repo $basename_chomped ($repo)"
     16 		basename_git=${basename_chomped}.git
     17 	else
     18 		basename_git=${parts[1]}
     19 	fi
     20 	if [ -e $basename_git ]; then
     21 		>&2 echo "folder $basename_git already exists, skipping"
     22 		continue
     23 	fi
     24 	echo "clone $url $gitargs to $basename_git"
     25 	git clone $gitargs $url $basename_git
     26 done
     27 
     28 if [ ! -z $1 ]; then
     29 	popd
     30 fi