#!/bin/bash # # Call git-submodule-move-git-dir for each repository in a tree # # Parameters BASENAME="`basename $0`" FOLDER="$1" # Checks if [ -z "$FOLDER" ]; then echo "usage: $BASENAME " exit 1 elif [ ! -d "$FOLDER" ]; then echo "$BASENAME: repository not found: $FOLDER" exit 1 elif [ ! -e "$FOLDER/.git" ]; then echo "$BASENAME: $FOLDER/.git not found" exit 1 fi cd $FOLDER # Find returns innermost folders first, which is essential for a # successful migration find -type f -name .git | while read repo; do folder="`dirname $repo`" git-submodule-move-git-dir $folder done