checkpatch: skip analysis for merge commits on kernel/common

These are upstream merges that likely hit issues in checkpatch.pl or
merges from other common kernel repositories where _this_ check has been
run as part of the developement process.

Change-Id: Ib489d57b74ffc128eec5f6bde253f139768e9445
Signed-off-by: Matthias Maennich <maennich@google.com>
diff --git a/static_analysis/checkpatch_presubmit.sh b/static_analysis/checkpatch_presubmit.sh
index d057601..2f88085 100755
--- a/static_analysis/checkpatch_presubmit.sh
+++ b/static_analysis/checkpatch_presubmit.sh
@@ -86,5 +86,16 @@
   exit 0
 fi
 
+# Skip checkpatch for merge commits on common kernels
+# These are upstream merges that likely hit issues in checkpatch.pl or merges
+# from other common kernel repositories where _this_ check has been run as part
+# of the developement process.
+if [ "${KERNEL_DIR}" == "common" ]; then
+    if [ $(git -C ${KERNEL_DIR} show --no-patch --format="%p" ${GIT_SHA1} | wc -w) -gt 1 ] ; then
+        echo "Merge commit detected for a ${KERNEL_DIR} kernel. Skipping this check."
+        exit 0
+    fi
+fi
+
 ${STATIC_ANALYSIS_SRC_DIR}/checkpatch.sh --git_sha1 ${GIT_SHA1} ${FORWARDED_ARGS[*]}