Permalink
Browse files

Add update script [ci skip]

  • Loading branch information...
1 parent d2f58f4 commit 1653c0ee879c37417f0343898e32fcf0b8887718 @chendrix chendrix committed Dec 1, 2016
Showing with 44 additions and 0 deletions.
  1. +44 −0 scripts/update
View
@@ -0,0 +1,44 @@
+#!/bin/bash
+set -e
+
+submodule_warning='Uncommitted submodules changes will be clobbered'
+unversioned_change_warning='Unversioned changes will be clobbered'
+
+function has_upstream() {
+ git rev-parse @{u} > /dev/null 2>&1
+}
+
+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"
+ echo ""
+ echo "NOTE: $submodule_warning"
+ exit 0
+fi
+
+echo ""
+echo "===> $submodule_warning <==="
+echo ""
+
+echo ""
+echo "===> $unversioned_change_warning <==="
+echo ""
+
+set -x # show the commands we are running
+
+has_upstream && git pull
+
+# Update submodule pointers; Clean out any submodule changes
+git submodule sync
+git submodule foreach --recursive 'git submodule sync; git clean -d --force --force'
+
+# Update submodule content, checkout if necessary
+git submodule update --init --recursive --force
+
+git clean -ffd
+
+set +x # stop showing commands
+
+echo "Update complete"

0 comments on commit 1653c0e

Please sign in to comment.