From d2a9d70c0977f02b4d52fa5e6d31f17c2a7aa313 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Wed, 11 Oct 2023 08:13:53 +1100 Subject: [PATCH] tools/ci.sh: Ensure enough commits are fetched for a common ancestor. This commit updates the ci script to automatically fetch all upstream if the common commit hasn't been found; this should preserve the speed of CI checks for most PR's, and use a reliable but slow fetch if needed for older ones. Signed-off-by: Andrew Leech --- tools/ci.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/ci.sh b/tools/ci.sh index efa492bd19..975ce86172 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -44,7 +44,9 @@ function ci_code_spell_run { function ci_commit_formatting_run { git remote add upstream https://github.com/micropython/micropython.git - git fetch --depth=100 upstream master + git fetch --depth=100 upstream master + # If the common ancestor commit hasn't been found, fetch more. + git merge-base upstream/master HEAD || git fetch --unshallow upstream master # For a PR, upstream/master..HEAD ends with a merge commit into master, exclude that one. tools/verifygitlog.py -v upstream/master..HEAD --no-merges } @@ -68,6 +70,8 @@ function ci_code_size_build { git checkout -b pull_request # save the current location git remote add upstream https://github.com/micropython/micropython.git git fetch --depth=100 upstream master + # If the common ancestor commit hasn't been found, fetch more. + git merge-base upstream/master HEAD || git fetch --unshallow upstream master # build reference, save to size0 # ignore any errors with this build, in case master is failing git checkout `git merge-base --fork-point upstream/master pull_request`