Skip to content

Instantly share code, notes, and snippets.

@cyborch
Created January 15, 2015 19:14
Show Gist options
  • Save cyborch/c927462823523bc5c8f2 to your computer and use it in GitHub Desktop.
Save cyborch/c927462823523bc5c8f2 to your computer and use it in GitHub Desktop.
Xcodeserver before integration trigger to ensure that the correct submodule revision is checked out
#!/bin/bash
# Ensure that pwd is $XCS_SOURCE_DIR/my_checkout_folder when
# executing this script as a "Before Integration" run script
# trigger.
#
# This should fix an issue in Xcodeserver which causes
# submodules to be checked out at HEAD of master branch in stead
# of the correct revision as specified in the owning module.
for DIR in `git submodule status | awk '{print $2}'` ; do
REV=`git submodule status $DIR | awk '{print $1}' | cut -c 2-1000`
ENDCONDITION=`echo $DIR | cut -c 1,2`
if [[ $ENDCONDITION == ".." ]] ; then
exit
fi
pushd $DIR >/dev/null
git reset --hard $REV >/dev/null 2>&1
resetsubmodules.sh
popd >/dev/null
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment