File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -76,14 +76,26 @@ lint() {
76
76
77
77
# Appends a report generated during the pre-commit hook.
78
78
append_pre_commit_report () {
79
- # Check whether the commit message already contains a report (e.g., as may be the case when amending a commit message; git commit --amend):
79
+ # Check whether the commit is a merge commit:
80
+ head -n 1 " ${commit_message} " | grep -q ' ^Merge branch' ;
81
+
82
+ # For merge commits, no need to append a report...
83
+ if [[ " $? " -eq 0 ]]; then
84
+ return 0
85
+ fi
86
+
87
+ # Check whether the commit message already contains a report (e.g., as may be the case when amending a commit message via git commit --amend):
80
88
grep -q ' type: pre_commit_static_analysis_report' " ${commit_message} "
81
89
82
- # Only append a report if the message doesn't contain an existing report...
83
- if [[ " $? " -ne 0 ]]; then
84
- echo ' ' >> " ${commit_message} "
85
- cat " ${pre_commit_report} " >> " ${commit_message} "
90
+ # If a message already includes a report, skip appending a report...
91
+ if [[ " $? " -eq 0 ]]; then
92
+ return 0
86
93
fi
94
+
95
+ # Append the report:
96
+ echo ' ' >> " ${commit_message} "
97
+ cat " ${pre_commit_report} " >> " ${commit_message} "
98
+
87
99
return 0
88
100
}
89
101
You can’t perform that action at this time.
0 commit comments