summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2012-02-03 14:54:58 +0100
committerJan Pokorný <jpokorny@redhat.com>2012-02-03 14:54:58 +0100
commitd8a3b76e6044689ebe4336abbcd21f677dbba31d (patch)
tree0e142976ecc6a58a84624d8f0febdff6640069e4
parentd171c770c2cb885e1af9801bdeb3a7375a208a82 (diff)
downloadvim4projects-d8a3b76e6044689ebe4336abbcd21f677dbba31d.tar.gz
vim4projects-d8a3b76e6044689ebe4336abbcd21f677dbba31d.tar.xz
vim4projects-d8a3b76e6044689ebe4336abbcd21f677dbba31d.zip
init.sh: handle git submodules better
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rwxr-xr-xinit.sh11
1 files changed, 4 insertions, 7 deletions
diff --git a/init.sh b/init.sh
index 4f2af2d..b7e709f 100755
--- a/init.sh
+++ b/init.sh
@@ -50,22 +50,19 @@ announce () {
do_git_submodule () {
# usage: $1=action ($1 passed from main), $2..$N=submodule(s)
ret=0
- # TODO: pushd $GIT_ROOT
+ git_prefix=$(git rev-parse --show-prefix)
for submodule in "${@:2}"; do
announce "$1 $submodule (git submodule)"
if [ "$1" == "get" ]; then
- # TODO: avoid this workaround
- if [ ! -f .gitmodules ]; then
- submodule="$SUBMODULES_DIR/$submodule"
- fi
- git submodule update --init "$submodule" 2>&1
+ pushd "$(git rev-parse --show-toplevel)" 2>/dev/null
+ git submodule update --init "${git_prefix}${submodule}" 2>&1
+ popd 2>/dev/null
else
do_del "$submodule"
fi
ret=$?
[ $ret -ne 0 ] && break
done
- # TODO: popd
check_ret $ret
}