GitHub Action and fetch_upstream.sh script limits fetch depth to 200.
With such depth, should the PR was based on very old tree, we couldn't
find the merge-base to diff again.
In theory, we could replace actions/checkout and fetch_upstream.sh to
fetch more than 200 depth. However, there isn't much gain from such
change and it will increase the time to fetch upstream for all PR.
Arguably, such problematic PR couldn't be built because other steps
would build changed packages' dependencies, too.
Let's complain and exit early instead.
The HEAD given by GitHub Action is always non-fast-forward merge commit.
In the next change, lint-commits will use the tip from
"changed_templates.sh".
Let pick the correct tip for interrogation.
From b881f32687 (travis/changed_templates: filter by git itself,
2020-05-23), we replaced git-diff(1) with git-diff-tree(1).
The change wasn't equivalence, though.
We used to compare between merge-base of FETCH_HEAD and HEAD.
From that commit, we started to compare FETCH_HEAD and HEAD instead.
Fix them by changing left tree-ish to the merge-base.
- Use plumbing git-diff-tree(1) instead of porcelain git-diff(1)
- Disable rename detection, gains some speed up and fix missing template
with name-status Renamed and Copied.
- Use "--diff-filter" to filter by Git itself.
- Tell Git to only check 'srcpkgs/*/template', this glob will only look
into template file inside direct sub-directory of srcpkgs
- With all of those options, we don't need a grep and a pipe