#!/bin/bash

if [ "$1" == "--help" ]; then
  echo "USAGE: $0"
  echo "    This command takes no arguments."
  echo ""
  echo "This script does a git submodule update on all submodules"
  exit 0
fi

set -x

$(dirname $0)/install-git-hooks

if [[ "$(git --version | grep 'version 1.7')x" != "x" ]]; then
  git pull && git submodule foreach --recursive git submodule sync && git submodule update --init --recursive
else
  git pull && git submodule sync --recursive && git submodule foreach --recursive git submodule sync  && git submodule update --init --recursive
fi
