git-svn-clone-externals icon indicating copy to clipboard operation
git-svn-clone-externals copied to clipboard

git-svn-externals-update is not working

Open mks-m opened this issue 14 years ago • 1 comments

if i have externals in subsubfolders of project script does not update them

mks-m avatar Sep 30 '10 09:09 mks-m

I had the same problem. This resolved it (I picked some lines from git-svn-externals-update):

diff --git a/git-svn-externals-check b/git-svn-externals-check
index fddc313..692daa9 100755
--- a/git-svn-externals-check
+++ b/git-svn-externals-check
@@ -1,19 +1,28 @@
 #!/bin/bash

-for dir in *; do
-    if [ -d $dir ]; then
-       cd $dir
-       STATUS=$(git status)
-       UNPUSHED=$(git-svn-check-unpushed)
-       if [ $(echo $STATUS|grep -c "clean") -lt 1 -o \
-           $(echo $UNPUSHED|grep -c "No unpushed") -lt 1 ]; then
-          echo '>>>>>>>>>>>>>>>>' $dir '<<<<<<<<<<<<<<<<'
-          git status
-          git-svn-check-unpushed
-          echo '----------------------------------------'
-       else
-          echo $dir 'is clean'
-       fi
-       cd ..
-   fi
+toplevel_directory="$(git rev-parse --show-cdup)"
+[ -n "$toplevel_directory" ] && { echo "please run from the toplevel directory"; exit 1; }
+
+find .git_externals -type d -name .git | while read gitdir; do
+    dir=$(dirname "$gitdir")
+    [ -d $dir ] || continue
+    dir=${dir#.git_externals/}
+    [ -d $dir ] || continue
+
+    pushd $dir
+    echo $dir
+
+    STATUS=$(git status)
+    UNPUSHED=$(git-svn-check-unpushed)
+    if [ $(echo $STATUS|grep -c "clean") -lt 1 -o \
+        $(echo $UNPUSHED|grep -c "No unpushed") -lt 1 ]; then
+        echo '>>>>>>>>>>>>>>>>' $dir '<<<<<<<<<<<<<<<<'
+        git status
+        git-svn-check-unpushed
+        echo '----------------------------------------'
+    else
+        echo $dir 'is clean'
+    fi
+
+    popd
 done

daald avatar Aug 11 '15 07:08 daald