Skip to content

Commit 33fe044

Browse files
committed
fix(gitutils): 🐛 handle branch checkout failure
1 parent fc52d6e commit 33fe044

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/gitutils/_git-release-prod.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ if [ -z "$flow" ] && [ -f .git/RELEASE ]; then
2828
flow=release
2929
name=$(cat .git/RELEASE)
3030
zz_log i "Release branch found: {Blue $name}"
31-
git checkout $flow/$name
31+
if ! git checkout $flow/$named; then
32+
zz_log e "Cannot switch to $flow/$name branch"
33+
exit 1
34+
fi
3235
fi
3336

3437
# Exit if no flow branch is found
@@ -49,9 +52,12 @@ if [ "$?" -eq 0 ] && [ -n "$GBV" ]; then
4952
if ! git commit -am "chore(release): $GBV"; then
5053
zz_log e "Cannot commit version & CHANGELOG"
5154
exit 1
55+
else
56+
git push origin $flow/$name
57+
zz_log s "Version & CHANGELOG committed and pushed"
5258
fi
5359

54-
if git flow $flow finish $name --push; then
60+
if git flow $flow finish $name --push --message "git flow release" --showcommands ; then
5561
zz_log s "Release finished: {B $GBV}"
5662
rm -f .git/RELEASE
5763
else

0 commit comments

Comments
 (0)