Junio C Hamano <gitster@xxxxxxxxx> writes: > Karthik Nayak <karthik.188@xxxxxxxxx> writes: > ... >> + R=${CI_MERGE_REQUEST_TARGET_BRANCH_SHA-${CI_MERGE_REQUEST_DIFF_BASE_SHA?}} >> + >> + if test -z "$R" >> + then >> + echo "CI_MERGE_REQUEST_DIFF_BASE_SHA should always exist!" >> + exit 1 >> + fi > > If you update the assignment to R to > > R=${CI_MERGE_REQUEST_TARGET_BRANCH_SHA-${CI_MERGE_REQUEST_DIFF_BASE_SHA:?}} > > an unset CI_MERGE_REQUEST_DIFF_BASE_SHA1 or an empty value in it > will be rejected there. Then you can lose the if/then/fi here. Actually, you also need to pay attention to the exit status of the assignment, i.e. R=${CI_MERGE_REQUEST_TARGET_BRANCH_SHA-${CI_MERGE_REQUEST_DIFF_BASE_SHA:?}} || exit