From 608bd502d89e2840c79cb5b7c22f52a1661871f4 Mon Sep 17 00:00:00 2001 From: Marco Ferrari Date: Tue, 27 Feb 2024 13:25:18 +0100 Subject: [PATCH] docs: suggest setting fetch-depth on ref errors (#5316) Emit a hopefully more helpful error message when the Git ref doesn't exist. The error message is the same we use when getting changed files only: it suggests checking that repository clone is not shallow, and that the full history is available. Additionally, when running on GitHub Actions, it also suggests checking the fetch-depth option of the actions/checkout step. Fix #5315 --- lib/functions/buildFileList.sh | 1 + lib/functions/validation.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/functions/buildFileList.sh b/lib/functions/buildFileList.sh index 422995e6..46ea0b6b 100755 --- a/lib/functions/buildFileList.sh +++ b/lib/functions/buildFileList.sh @@ -8,6 +8,7 @@ function IssueHintForFullGitHistory() { info "See https://github.com/super-linter/super-linter#get-started" info "Is shallow repository: $(git -C "${GITHUB_WORKSPACE}" rev-parse --is-shallow-repository)" } +export -f IssueHintForFullGitHistory function GenerateFileDiff() { local DIFF_GIT_DEFAULT_BRANCH_CMD diff --git a/lib/functions/validation.sh b/lib/functions/validation.sh index 168b48b1..880d891e 100755 --- a/lib/functions/validation.sh +++ b/lib/functions/validation.sh @@ -200,6 +200,7 @@ function ValidateGitShaReference() { debug "Validate that the GITHUB_SHA reference (${GITHUB_SHA}) exists in this Git repository." if ! CheckIfGitRefExists "${GITHUB_SHA}"; then + IssueHintForFullGitHistory fatal "The GITHUB_SHA reference (${GITHUB_SHA}) doesn't exist in this Git repository" else debug "The GITHUB_SHA reference (${GITHUB_SHA}) exists in this repository"