Commit 91b45a74 authored by Ram-Z's avatar Ram-Z

Don't abort when git is behind/ahead/diverged

parent f9556375
......@@ -125,6 +125,17 @@ actual_chroot() {
sudo systemd-nspawn -q --user=$_user -jD $PWD/${_chroot} -M "$_user-$chroot_name-$uniqueid" "${binds[@]}" "${setenvs[@]}"
}
yesno() {
while true; do
read -r -p "$1 [Yn] " choice
case "$choice" in
Y|y) return 0 ;;
N|n) return 1 ;;
'') return 0 ;;
esac
done
}
check_buildsystem_status() {
# fetch the latest updates
git remote update > /dev/null
......@@ -133,20 +144,15 @@ check_buildsystem_status() {
REMOTE=$(git rev-parse @{u})
BASE=$(git merge-base @ @{u})
if [ $LOCAL = $REMOTE ]; then
return 0 ;
elif [ $LOCAL = $BASE ]; then
error "New updates for the BuildSystem are available!"
error "you need to use 'git pull'"
elif [ $REMOTE = $BASE ]; then
error "You did some changes of the BuildSystem"
error "create a patch and share them on the ml"
error "prior to pushing them on master"
else
error "The BuildSystem diverged from upstream"
if [ $LOCAL = $BASE ]; then
error "New updates for the buildsystem are available!"
if yesno "Would you like to pull new changes?"; then
git pull
return $?
fi
fi
return 1 ;
return 0 ;
}
source chakra/bin/functions/messages
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment