Make sources-branch-updater checkout the SHA properly

Currently the sources-branch-updater script incorrectly handles the
clone/checkout process and ends up always copying the master branch
files into whichever branch it's trying to update.

This fixes it so that it correctly checks out to the correct SHA
before copying the updated files over.

Change-Id: I684bc060bf0a4bf4398673b4ca84a2660ee6e1b9
This commit is contained in:
Jesse Pretorius 2016-01-18 15:02:44 +00:00
parent 8829c1d1a3
commit d8acb70301

View File

@ -27,7 +27,7 @@ IFS=$'\n'
if echo "$@" | grep -e '-h' -e '--help';then
echo "
Options:
-b|--branch (name of branch)
-b|--branch (name of branch, eg: stable/liberty)
-s|--service-file (path to service file to parse)
"
exit 0
@ -85,7 +85,10 @@ for repo in $(grep 'git_repo\:' ${SERVICE_FILE}); do
rm -rf ${repo_tmp_path}
# Do a shallow clone of the repo to work with
git clone --quiet --depth=1 --origin ${branch_sha} ${repo_address} ${repo_tmp_path}
git clone --quiet --depth=10 --branch ${ONLINE_BRANCH} --no-checkout --single-branch ${repo_address} ${repo_tmp_path}
pushd ${repo_tmp_path} > /dev/null
git checkout --quiet ${branch_sha}
popd > /dev/null
# Update the policy files
find ${repo_tmp_path}/etc -name "policy.json" -exec \