ci: split up merge-base failure fetch in static checks
This small change splits up the fetch after a merge-base command failure
in the static checks script into two steps:
1. Unshallow the repository *independently*, then
2. Fetch the desired change.
This is really a last-ditch attempt to resolve issues like:
----------------------------------------------
-- Running static checks on the source code --
----------------------------------------------
/home/buildslave/agent/workspace/tf-a-static-checks/trusted-firmware-a
error: Could not read 81445dd10705799610307be57125ac4bae1a5730
fatal: Failed to traverse parents of commit c1ad67a174528f2295fac0f4c728a4d4398aa15c
error: remote did not send all necessary objects
fatal: Not a valid object name FETCH_HEAD
Failed to find merge base, fetching entire change history
error: Could not read 81445dd10705799610307be57125ac4bae1a5730
fatal: Failed to traverse parents of commit c1ad67a174528f2295fac0f4c728a4d4398aa15c
error: remote did not send all necessary objects
error: pathspec 'FETCH_HEAD' did not match any file(s) known to git
error: Could not read 81445dd10705799610307be57125ac4bae1a5730
fatal: Failed to traverse parents of commit c1ad67a174528f2295fac0f4c728a4d4398aa15c
error: remote did not send all necessary objects
fatal: Not a valid object name FETCH_HEAD
Failed to determine merge base after fetching. Exiting.
... because I am very definitely running out of ideas.
Signed-off-by: Chris Kay <chris.kay@arm.com>
Change-Id: Ie3087b117a5096770502042be89cf11d01c6d562
diff --git a/script/static-checks/static-checks.sh b/script/static-checks/static-checks.sh
index 6ff25a8..05747f4 100755
--- a/script/static-checks/static-checks.sh
+++ b/script/static-checks/static-checks.sh
@@ -30,7 +30,8 @@
fi
fi
- git fetch --unshallow --update-shallow origin "$GERRIT_REFSPEC"
+ git fetch --unshallow
+ git fetch origin "$GERRIT_REFSPEC"
git checkout FETCH_HEAD
merge_base=$(get_merge_base)