Print base commit for source linters
authorPaul Bauer <paul.bauer.q@gmail.com>
Wed, 29 Apr 2020 12:47:58 +0000 (12:47 +0000)
committerPaul Bauer <paul.bauer.q@gmail.com>
Wed, 29 Apr 2020 12:47:58 +0000 (12:47 +0000)
Added a printout for the branch used for comparing.

Will use to see if branch point selection is working properly and to see
if the clang-tidy script picks up the warnings it should.

Change-Id: I791d2a11f98cd8e0cf0d06e92a9980cd9d038874

admin/gitlab-ci/lint.gitlab-ci.yml

index e158ddb5f43b339eca9072963b59aa853d57e888..5e485d5903524341062976671f31e5d19df3073f 100644 (file)
@@ -56,7 +56,13 @@ clang-tidy:test:
     KUBERNETES_MEMORY_LIMIT: 4Gi
   script:
     # TODO (issue #3272) `master` is not appropriate for use on release-xxxx branches, how should we handle that?
-    - REV=$(git fetch -q https://gitlab.com/gromacs/gromacs.git master && git show -s --pretty=format:"%h" `git merge-base --fork-point FETCH_HEAD HEAD`)
+    - REV=$(git fetch -q https://gitlab.com/gromacs/gromacs.git master && git show -s --pretty=format:"%h" `git merge-base FETCH_HEAD HEAD`)
+    - HEAD_REV=$(git show -s --pretty=format:"%h" HEAD)
+    - if [[ "$REV" == "$HEAD_REV" ]] ; then
+        REV="HEAD~1" ;
+      fi
+    - echo "Revision used for branch point is $REV"
+    - git show -s $REV
     - RUN_CLANG_TIDY=run-clang-tidy-$COMPILER_MAJOR_VERSION bash admin/clang-tidy.sh check --parallel=$KUBERNETES_CPU_LIMIT --warnings=clang-tidy.log --rev=$REV -B=$BUILD_DIR
     - grep -iq "found code issues" clang-tidy.log | tee code-lint.txt || true
     - if [ -s code-lint.txt ] ; then echo "clang-tidy.sh found issues"; exit 1; fi
@@ -83,6 +89,12 @@ clang-format:
   script:
     # TODO (issue #3272) `master` is not appropriate for use on release-xxxx branches, how should we handle that?
     - REV=$(git fetch -q https://gitlab.com/gromacs/gromacs.git master && git show -s --pretty=format:"%h" `git merge-base FETCH_HEAD HEAD`)
+    - HEAD_REV=$(git show -s --pretty=format:"%h" HEAD)
+    - if [[ "$REV" == "$HEAD_REV" ]] ; then
+        REV="HEAD~1" ;
+      fi
+    - echo "Revision used for branch point is $REV"
+    - git show -s $REV
     - CLANG_FORMAT=clang-format-$COMPILER_MAJOR_VERSION admin/clang-format.sh check --rev=$REV --warnings=clang-format.log
     - grep -iq "needs formatting" clang-format.log | tee formatting.txt || true
     - if [ -s formatting.txt ] ; then echo "clang-format.sh found issues"; exit 1; fi
@@ -107,6 +119,12 @@ copyright-check:
   script:
     # TODO (issue #3272) `master` is not appropriate for use on release-xxxx branches, how should we handle that?
     - REV=$(git fetch -q https://gitlab.com/gromacs/gromacs.git master && git show -s --pretty=format:"%h" `git merge-base FETCH_HEAD HEAD`)
+    - HEAD_REV=$(git show -s --pretty=format:"%h" HEAD)
+    - if [[ "$REV" == "$HEAD_REV" ]] ; then
+        REV="HEAD~1" ;
+      fi
+    - echo "Revision used for branch point is $REV"
+    - git show -s $REV
     - admin/copyright.sh check --rev=$REV --warnings=copyright.log
     - grep -iq "copyright year" copyright.log | tee years.log || true
     - grep -iq "copyright header" copyright.log | tee headers.log || true