aboutsummaryrefslogtreecommitdiff
path: root/git-update-superproject
blob: 603053a4f668aed9f2bc78e8bd11e9adb4de45b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
#
# Updates a superproject
#

# Parameters
BASENAME="`basename $0`"

# Check
if [ ! -e ".git" ]; then
  echo "$BASENAME: not a git repository"
  exit 1
fi

# Ensure we have the right ssh command
GIT_SSH_COMMAND="`git config core.sshCommand`"

# Run
git fetch --all
git pull $* || exit 1
git submodule sync   --recursive

if [ ! -z "$GIT_SSH_COMMAND" ]; then
  GIT_SSH_COMMAND="$GIT_SSH_COMMAND" git submodule update --recursive --init
else
  git submodule update --recursive --init
fi

git submodules-checkout-branch