#!/usr/bin/env bash set -e # This is run by git submodule foreach inside the coreos-update-submodule script # Some info is passed via variable. if [ -z "$sm_path" ]; then echo "This scripts should not be run directly" exit 1 fi UPSTREAM_URL=$(git config --file "${toplevel}/.gitmodules" --get "submodule.${name}.upstream-url") DOWNSTREAM_URL=$(git config --file "${toplevel}/.gitmodules" --get "submodule.${name}.url") TRACKING_BRANCH=$(git config --file "${toplevel}/.gitmodules" --get "submodule.${name}.branch") echo "Pull $TRACKING_BRANCH from ${UPSTREAM_URL} and pushing to ${DOWNSTREAM_URL}" git pull "${UPSTREAM_URL}" "${TRACKING_BRANCH}" --ff-only git push "${DOWNSTREAM_URL}" "${TRACKING_BRANCH}"