1
0
Fork 0
mirror of https://github.com/xHyroM/void-packages.git synced 2024-12-29 07:21:06 +01:00
void-packages/common/travis/changed_templates.sh
2024-03-29 08:12:19 +01:00

29 lines
761 B
Bash
Executable file

#!/bin/sh
#
# changed_templates.sh
tip="$(git rev-list -1 --parents HEAD)"
case "$tip" in
# This is a merge commit, pick last parent
*" "*" "*) tip="${tip##* }" ;;
# This is a non-merge commit, pick itself
*) tip="${tip%% *}" ;;
esac
base="$(git merge-base origin/HEAD "$tip")"
[ $(git rev-list --count "$tip" "^$base") -lt 200 ] || {
echo "::error title=Branch out of date::Your branch is too out of date. Please rebase on upstream and force-push."
exit 1
}
echo "$base $tip" >/tmp/revisions
/bin/echo -e '\x1b[32mChanged packages:\x1b[0m'
git diff-tree -r --no-renames --name-only --diff-filter=AM \
"$base" "$tip" \
-- 'srcpkgs/*/template' |
cut -d/ -f 2 |
xargs ./xbps-src sort-dependencies |
tee /tmp/templates |
sed "s/^/ /" >&2