Skip to content

Commit

Permalink
Simplify update_submodules script
Browse files Browse the repository at this point in the history
  • Loading branch information
andylolz committed Apr 19, 2018
1 parent 366842c commit 6f4c13a
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions update_submodules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,16 @@ for version in 1.04 1.05 2.01 2.02 2.03; do
# Check out a new branch to get around branch protection
git checkout -b update-submodules-$timestamp-$version

# Loop over each subfolder, pull the latest version and add to staging
for folder in IATI-Codelists IATI-Extra-Documentation IATI-Schemas IATI-Rulesets; do
# Enter the specified folder (which contains the submodule)
cd $folder
# Discard local changes to submodules
# See: https://stackoverflow.com/a/27415757/2323348
git submodule deinit -f .
git submodule update --init

# Ensure that we are on the correct branch (i.e. Git branch)
git checkout version-$version
# Pull the latest versions of submodules
git submodule update --remote

# Pull the latest code from origin for this version (i.e. Git branch)
git pull origin version-$version

# Go back to the SSOT folder
cd ..

# Add the specified folder (which contains the submodule) to staging
git add $folder
done
# Git add submodules
git add IATI-Codelists IATI-Extra-Documentation IATI-Schemas IATI-Rulesets

# Commit updated submodules
git commit -m "Updated submodules (using script) "$version
Expand Down

0 comments on commit 6f4c13a

Please sign in to comment.