File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -42,8 +42,18 @@ cleanup() {
4242
4343# Checks if commits exist to push, as `git push` will execute regardless of whether commits exist to push or not.
4444has_commits () {
45- echo ' Checking for commits to push...' >&2
46- local commits=" $( git log origin/${GIT_CURRENT_BRANCH} ..${GIT_CURRENT_BRANCH} -- --oneline) "
45+ local commits
46+
47+ echo ' Checking if remote branch exists...' >&2
48+ if git branch -r | grep " ${GIT_CURRENT_BRANCH} " ; then
49+ echo ' Remote branch exists.' >&2
50+ echo ' Checking for commits to push...' >&2
51+ commits=$( git log origin/" ${GIT_CURRENT_BRANCH} " .." ${GIT_CURRENT_BRANCH} " -- --oneline)
52+ else
53+ echo ' Remote branch does not exist.' >&2
54+ echo ' Checking for commits to push...' >&2
55+ commits=$( git log " ${GIT_CURRENT_BRANCH} " -- --oneline)
56+ fi
4757 if [[ -z " ${commits} " ]]; then
4858 echo ' No commits to push.'
4959 return 1
@@ -82,6 +92,7 @@ main() {
8292 if [[ " $? " -ne 0 ]]; then
8393 on_error 1
8494 fi
95+ exit 1
8596 check_licenses
8697 if [[ " $? " -ne 0 ]]; then
8798 on_error 1
You can’t perform that action at this time.
0 commit comments