Add --ff-only to git pull command.

Don't make or commit merges when running 'git pull' - the assumption
is that we're tracking an upstream branch that should always be
possible to fast-forward. Better to fail with an error if we can't
do this and allow the user to intervene to resolve the problem.
This commit is contained in:
Simon Howard 2017-02-19 17:12:31 -05:00
parent 840683540e
commit 900610a0ac

View file

@ -11,7 +11,15 @@ fetch_git::init() {
do_fetch() { do_fetch() {
if [ -e "$PACKAGE_BUILD_DIR/.git" ]; then if [ -e "$PACKAGE_BUILD_DIR/.git" ]; then
cd "$PACKAGE_BUILD_DIR" cd "$PACKAGE_BUILD_DIR"
git pull # Assume we're tracking an upstream branch, and to be cautious,
# don't ever perform or commit merges. If a merge needs to be made,
# let the user resolve the problem themselves.
git pull --ff-only || chocpkg::abort \
"Failed to cleanly 'git pull' from upstream. You may need to" \
"manually resolve merge conflicts with local changes, eg." \
"" \
" cd $PACKAGE_BUILD_DIR" \
" git pull"
else else
git clone -b "$GIT_BRANCH" "$GIT_URL" "$PACKAGE_BUILD_DIR" git clone -b "$GIT_BRANCH" "$GIT_URL" "$PACKAGE_BUILD_DIR"
fi fi