aboutsummaryrefslogtreecommitdiff
path: root/modup.sh
blob: ea7c0a9ff237266c88213be31a548cfe9de3c802 (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
30
31
32
33
#! /bin/sh

# Update all submodules to remote HEAD by running:
#
# git submodule update --remote
#
# Normally you would follow this with commit.
#

. etc/git/modules

wd=`pwd`

for i in $sub_modules; do
  echo "submodule update $i" 1>&2
  cd $i
  git submodule update --remote $*

  # In case our submodules have their own submodules.
  #
  git submodule update --init --recursive $*

  # Set it back to remote's HEAD.
  #
  git submodule update --remote $*

  if [ $? -ne 0 ]; then
    echo "submodule update FAILED" 1>&2
    exit 1
  fi

  cd $wd
done