Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git-svn-externals-update is not working #4

Open
mks-m opened this issue Sep 30, 2010 · 1 comment
Open

git-svn-externals-update is not working #4

mks-m opened this issue Sep 30, 2010 · 1 comment

Comments

@mks-m
Copy link

mks-m commented Sep 30, 2010

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

@daald
Copy link

daald commented Aug 11, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants