aboutsummaryrefslogtreecommitdiff
path: root/common/travis
diff options
context:
space:
mode:
authorĐoàn Trần Công Danh <congdanhqx@gmail.com>2022-09-16 01:50:39 +0000
committerĐoàn Trần Công Danh <sgn.danh@gmail.com>2022-09-17 16:32:50 +0000
commit7510b96218505a401831dfa3cbb45aca9cf8d6de (patch)
tree61f39d7cd9099482d78ac6c85ffdcf7cc8c4f459 /common/travis
parent77db5140783acb6a5206ea8de8e176be5862fbe1 (diff)
downloadvoid-packages-7510b96218505a401831dfa3cbb45aca9cf8d6de.tar
void-packages-7510b96218505a401831dfa3cbb45aca9cf8d6de.tar.gz
void-packages-7510b96218505a401831dfa3cbb45aca9cf8d6de.tar.bz2
void-packages-7510b96218505a401831dfa3cbb45aca9cf8d6de.tar.lz
void-packages-7510b96218505a401831dfa3cbb45aca9cf8d6de.tar.xz
void-packages-7510b96218505a401831dfa3cbb45aca9cf8d6de.tar.zst
void-packages-7510b96218505a401831dfa3cbb45aca9cf8d6de.zip
common: simplify logic to find git
From chroot-git 2.33.1, we always have an executable named git for other build infrastructure and lints. Let's remove the shenanegan to find which git to be used, prepend the path to chroot-git's git into $PATH, and let's the shell call the correct git for us instead.
Diffstat (limited to 'common/travis')
-rwxr-xr-xcommon/travis/changed_templates.sh12
-rwxr-xr-xcommon/travis/fetch_upstream.sh10
2 files changed, 7 insertions, 15 deletions
diff --git a/common/travis/changed_templates.sh b/common/travis/changed_templates.sh
index 686436ce432..3c8acf78763 100755
--- a/common/travis/changed_templates.sh
+++ b/common/travis/changed_templates.sh
@@ -2,19 +2,15 @@
#
# changed_templates.sh
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-fi
+PATH="/usr/libexec/chroot-git:$PATH"
-tip="$($GIT_CMD rev-list -1 --parents HEAD)"
+tip="$(git rev-list -1 --parents HEAD)"
case "$tip" in
*" "*" "*) tip="${tip##* }" ;;
*) tip="${tip%% *}" ;;
esac
-base="$($GIT_CMD merge-base FETCH_HEAD "$tip")" || {
+base="$(git merge-base FETCH_HEAD "$tip")" || {
echo "Your branches is based on too old copy."
echo "Please rebase to newest copy."
exit 1
@@ -23,7 +19,7 @@ base="$($GIT_CMD merge-base FETCH_HEAD "$tip")" || {
echo "$base $tip" >/tmp/revisions
/bin/echo -e '\x1b[32mChanged packages:\x1b[0m'
-$GIT_CMD diff-tree -r --no-renames --name-only --diff-filter=AM \
+git diff-tree -r --no-renames --name-only --diff-filter=AM \
"$base" "$tip" \
-- 'srcpkgs/*/template' |
cut -d/ -f 2 |
diff --git a/common/travis/fetch_upstream.sh b/common/travis/fetch_upstream.sh
index 049cfd69e54..40c136f3857 100755
--- a/common/travis/fetch_upstream.sh
+++ b/common/travis/fetch_upstream.sh
@@ -2,14 +2,10 @@
#
# changed_templates.sh
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-fi
+PATH="/usr/libexec/chroot-git:$PATH"
# required by git 2.35.2+
-$GIT_CMD config --global --add safe.directory "$PWD"
+git config --global --add safe.directory "$PWD"
/bin/echo -e '\x1b[32mFetching upstream...\x1b[0m'
-$GIT_CMD fetch --depth 200 https://github.com/void-linux/void-packages.git master
+git fetch --depth 200 https://github.com/void-linux/void-packages.git master