Skip to content

Commit 6c9a4d6

Browse files
Arm backend: Allow revert commits in pre-push hook (#18193)
Signed-off-by: Adrian Lundell <adrian.lundell@arm.com>
1 parent db45719 commit 6c9a4d6

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

backends/arm/scripts/pre-push

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,15 @@ for COMMIT in ${COMMITS}; do
157157
SUBJECT=$(echo "$COMMIT_MSG" | head -n1)
158158
BODY=$(echo "$COMMIT_MSG" | tail -n +2)
159159

160-
# Check subject length (72 chars)
160+
# Check subject length (72 chars), except for revert commits.
161+
is_revert_commit=false
162+
if [[ "$SUBJECT" =~ ^(Arm\ backend:\ )?Revert(\ |$) ]]; then
163+
is_revert_commit=true
164+
fi
165+
161166
SUBJECT_MAX_LEN=72
162-
if [ ${#SUBJECT} -gt ${SUBJECT_MAX_LEN} ]; then
167+
if [ ${#SUBJECT} -gt ${SUBJECT_MAX_LEN} ] && \
168+
[[ $is_revert_commit == false ]]; then
163169
echo -e "${ERROR} Subject exceeds ${SUBJECT_MAX_LEN} characters:"\
164170
"'${SUBJECT}'" >&2
165171

@@ -216,7 +222,8 @@ for COMMIT in ${COMMITS}; do
216222
fi
217223

218224
# Require 'Arm backend: ' prefix when the commit only touches Arm backend/examples files
219-
if [[ $only_arm_changes == true && $has_arm_backend_prefix == false ]]; then
225+
if [[ $only_arm_changes == true && $has_arm_backend_prefix == false && \
226+
$is_revert_commit == false ]]; then
220227
echo -e "${ERROR} Subject must start with 'Arm backend: ' when only backends/arm or examples/arm files are modified." >&2
221228
FAILED=1
222229
fi

0 commit comments

Comments
 (0)