Skip to content

Commit ea07d50

Browse files
committed
travis: separate check patch and age of git base
As requested in fix for checkpatch issue PR #2543 which will be rebased on top of this. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
1 parent 7183af0 commit ea07d50

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

.travis.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ dist: focal
1717
#
1818
# - When it's too shallow it will save zero time because fetching pull
1919
# requests with a base older than the shallow history will take as
20-
# much time as cloning the entire repo... without even providing the
21-
# entire repo information as checkpatch seems to be producing very
22-
# confusing garbage in that case. See example and discussion in
20+
# much time as cloning the entire repo.
21+
# See example and discussion in
2322
# https://github.com/thesofproject/linux/pull/2341
2423
# (The workaround is of course to rebase the pull request)
2524
git:
@@ -47,25 +46,30 @@ install:
4746

4847
jobs:
4948
include:
49+
50+
# Show how "late" the PR base is = how much code the PR submission
51+
# misses from the target branch.
5052
- if: type = pull_request
51-
# These two are combined because they both need a merge base and
52-
# locally unshallowing .git/ seems time consuming for some reason.
53-
# Without the merge base, the --xxxstats will either fail or be
54-
# wrong and checkpatch prints confusing garbage.
55-
name: checkpatch and age of git base
53+
name: age of git base
5654
script:
5755
# Start with some visual and plain English context. A picture is
5856
# worth thousand words and makes all the rest less abstract.
5957
- *short_log
6058
- git --no-pager log --oneline --graph --decorate
6159
--max-count=5 "${TRAVIS_BRANCH}"
60+
61+
# We need a merge-base because 'git diff A...B' silently (!)
62+
# degrades to 'git diff A..B' when B is shallow and 'git rev-list
63+
# ^A B | wc' is silently (!) truncated.
64+
#
6265
# If the merge base is missing then the shallow depth
6366
# optimization has _already_ failed because Travis' already
6467
# fetched practically the entire history with a "git fetch
6568
# github pulls/1234/merge" command. The very long duration of
6669
# that earlier fetch merge command is hidden in Travis logs
6770
# under the git clone command _wrongly_ advertised as quick!
68-
- git merge-base "${TRAVIS_PULL_REQUEST_SHA}" "${TRAVIS_BRANCH}" ||
71+
- &unshallow_for_merge_base
72+
git merge-base --all "${TRAVIS_PULL_REQUEST_SHA}" "${TRAVIS_BRANCH}" ||
6973
git fetch --unshallow https://github.com/"${TRAVIS_REPO_SLUG}"
7074
"${TRAVIS_BRANCH}"
7175
# Show how "late" the PR base is
@@ -81,6 +85,17 @@ jobs:
8185
# Note $behind is NOT comparable to clone depth in repos with merges.
8286
- '[ "$behind" -lt 1000 ] # is the PR base too far behind?'
8387

88+
- name: checkpatch
89+
script:
90+
# If git misses this merge base then 'git rev-list
91+
# ^${TRAVIS_BRANCH} ${TRAVIS_PULL_REQUEST_SHA}' will tell
92+
# checkpatch to scan practically every single git commit in the
93+
# repo.
94+
#
95+
# FIXME: this addresses only pull requests without any merge
96+
# submitted as part of the pull request itself.
97+
- *unshallow_for_merge_base
98+
8499
# New Ubuntu 20.04 location
85100
- sudo mkdir -p /usr/share/codespell && sudo ln -s
86101
/usr/lib/python3/dist-packages/codespell_lib/data/dictionary.txt

0 commit comments

Comments
 (0)