+# go over packages that do not have .git
+if [ -d "$stashdir" ]; then
+ echo >&2 "Previous stash dir exists: $stashdir, remove it to continue"
+ exit 1
+fi
+install -d $stashdir
+stashdir=$(readlink -f $stashdir)
+for pkg in */; do
+ # skip symlinks
+ test -L "${pkg%/}" && continue
+ # skip packages which do have .git
+ test -d "$pkg/.git" && continue
+ # skip if it's the stash dir itself
+ pkg=$(readlink -f $pkg)
+ test "$pkg" = "$stashdir" && continue
+
+ echo "* Package $pkg does not have .git, stashing"
+ mv $pkg $stashdir
+done
+rmdir --ignore-fail-on-non-empty $stashdir
+