Re: [PATCH v5 4/6] ci: run style check on GitHub and GitLab
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 18, 2024, 16:04 UTC
- Message-ID
- <xmqqmsmewusf.fsf@gitster.g>
- In-Reply-To
- <xmqqmsmeycj7.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 16 quoted lines
> Karthik Nayak <karthik.188@gmail.com> 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