vp-build/common/travis/changed_templates.sh

28 lines
639 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 FETCH_HEAD "$tip")" || {
echo "Your branches is based on too old copy."
echo "Please rebase to newest copy."
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 |
tee /tmp/templates |
sed "s/^/ /" >&2