diff options
Diffstat (limited to 'git-submodule-move-all-git-dirs')
-rwxr-xr-x | git-submodule-move-all-git-dirs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/git-submodule-move-all-git-dirs b/git-submodule-move-all-git-dirs index 41a7352..72e1aa3 100755 --- a/git-submodule-move-all-git-dirs +++ b/git-submodule-move-all-git-dirs @@ -5,15 +5,23 @@ # Parameters BASENAME="`basename $0`" +FOLDER="$1" # Checks -if [ ! -e ".git" ]; then - echo "please run this command in the top-level repository folder" +if [ -z "$FOLDER" ]; then + echo "usage: $BASENAME <repository-path>" + 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 -# If we invert find results so we begin conversion at the toplevel folders -#find -type f -name .git | tac | while read repo; do +cd $FOLDER + +# Find returns innermost folders first find -type f -name .git | while read repo; do folder="`dirname $repo`" git-submodule-move-git-dir $folder |