1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/streams_ynh.git synced 2024-09-03 20:26:20 +02:00

switch to release only if ahead of dev

This commit is contained in:
dragondaddy 2023-11-14 03:52:56 +01:00
parent 07c4ed1a8c
commit 563f00e675

View file

@ -66,10 +66,17 @@ get__free_footprint() {
set__git_branch_mode() { set__git_branch_mode() {
if [ "$git_branch_mode" -eq "0" ]; then if [ "$git_branch_mode" -eq "0" ]
# If git_branch was set to 0, switch to "release" branch then
(cd "$install_dir" && git checkout release) # We allow switch back to "release" only if the branch is ahead of "dev"
ynh_print_info "Switching to \"release\" branch" if [ -z "$(cd "$install_dir" && git log release..dev)" ]
then
# If git_branch was set to 0, switch to "release" branch
(cd "$install_dir" && git checkout release)
ynh_print_info "Switching to \"release\" branch"
else
ynh_print_err --message="\"release\" branch is behind your local \"dev\" branch, rolling back is not allowed here"
exit 0
elif [ "$git_branch_mode" -eq "1" ]; then elif [ "$git_branch_mode" -eq "1" ]; then
# If git_branch was set to 1, switch to "dev" branch # If git_branch was set to 1, switch to "dev" branch
(cd "$install_dir" && git checkout dev) (cd "$install_dir" && git checkout dev)