gitlab-ci: Check last 20 commits on force push
authorAndreas Schneider <asn@samba.org>
Tue, 19 Feb 2019 15:10:16 +0000 (16:10 +0100)
committerAndreas Schneider <asn@samba.org>
Wed, 20 Feb 2019 16:24:01 +0000 (17:24 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
.gitlab-ci.yml

index a2bb099fae318f3f0eac5e498290f9ab873541cb..365d834e65bde81e8407cb75347e67308952c770 100644 (file)
@@ -82,12 +82,12 @@ fedora/csbuild:
   script:
   - |
     if [[ -z "$CI_COMMIT_BEFORE_SHA" ]]; then
-        export CI_COMMIT_BEFORE_SHA=$(git rev-parse HEAD^)
+        export CI_COMMIT_BEFORE_SHA=$(git rev-parse "${CI_COMMIT_SHA}~20")
     fi
 
     # Check if the commit exists in this branch
     # This is not the case for a force push
-    git branch --contains $CI_COMMIT_BEFORE_SHA 2>/dev/null || export CI_COMMIT_BEFORE_SHA=$(git rev-parse HEAD^)
+    git branch --contains $CI_COMMIT_BEFORE_SHA 2>/dev/null || export CI_COMMIT_BEFORE_SHA=$(git rev-parse "${CI_COMMIT_SHA}~20")
 
     export CI_COMMIT_RANGE="$CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA"