Skip to content

Commit 306cefc

Browse files
Arm backend: Relax pre-push header checks (#16195)
* Warn when files lack Arm headers instead of failing license check * Keep year enforcement when an Arm header is present * Skip commits already on upstream to avoid rebase noise cc @freddan80 @per @zingo @oscarandersson8218 @digantdesai Signed-off-by: Sebastian Larsson <[email protected]>
1 parent 2bc465a commit 306cefc

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

backends/arm/scripts/pre-push

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ VERBS="Add|Fix|Update|Refactor|Improve|Remove|Change|Implement|Create|Modify|"\
3333
"Handle|Ignore|Interpret|Instantiate|Invoke|Limit|Load|Modify|Permit|Print|"\
3434
"Profile|Recalculate|Reconstruct|Redefine|Redesign|Reevaluate|Relocate|Remap|"\
3535
"Render|Reposition|Request|Revert|Sanitize|Specify|Strengthen|Stub|Substitute|"\
36-
"Tag|Tweak|Unify|Unlock|Unset|Use|Validate|Verify|Rename"
36+
"Tag|Tweak|Unify|Unlock|Unset|Use|Validate|Verify|Rename|Relax"
3737

3838
# Remote branch
3939
REMOTE=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null)
@@ -68,6 +68,11 @@ if [ -z "$COMMITS" ]; then
6868
fi
6969

7070
for COMMIT in ${COMMITS}; do
71+
if [ -n "$REMOTE" ] && git merge-base --is-ancestor "$COMMIT" "$REMOTE"; then
72+
echo -e "${INFO} Skipping commit ${COMMIT} (already on $REMOTE)"
73+
continue
74+
fi
75+
7176
# If commit header contains WIP, everything is ok
7277
git rev-list --format=%s --max-count=1 ${COMMIT} | grep -q WIP && \
7378
continue
@@ -95,8 +100,14 @@ for COMMIT in ${COMMITS}; do
95100
commit_files=$(git diff-tree --no-commit-id --name-only \
96101
--diff-filter=ACMR ${COMMIT} -r)
97102
for commited_file in $commit_files; do
98-
head $commited_file | grep -q "$current_year Arm"
99-
if [[ $? != 0 ]]; then
103+
file_header=$(head "$commited_file")
104+
if ! echo "$file_header" | grep -qi "Arm"; then
105+
echo -e "${WARNING} No Arm copyright header in ${commited_file}"\
106+
" (skipping license year check)"
107+
continue
108+
fi
109+
110+
if ! echo "$file_header" | grep -q "$current_year Arm"; then
100111
echo -e "${ERROR} Header in $commited_file did not contain"\
101112
"'$current_year Arm'"
102113
failed_license_check=true

0 commit comments

Comments
 (0)