From 5321a475ad26021bcbf4e100f293ff178678be13 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 10 May 2025 20:21:14 -0700 Subject: [PATCH 1/3] Diagnostics --- git-clone-related | 2 ++ tests/git-clone-related-test/test-git-clone-related.sh | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/git-clone-related b/git-clone-related index 3090719..cffcf6a 100755 --- a/git-clone-related +++ b/git-clone-related @@ -49,6 +49,8 @@ if [ "$1" = "--debug" ] ; then set -x fi +DEBUG=1 + # FALLBACK_BRANCH may be unset. if [ "$1" = "--upstream-branch" ] ; then shift diff --git a/tests/git-clone-related-test/test-git-clone-related.sh b/tests/git-clone-related-test/test-git-clone-related.sh index 95b6b46..404feef 100755 --- a/tests/git-clone-related-test/test-git-clone-related.sh +++ b/tests/git-clone-related-test/test-git-clone-related.sh @@ -38,12 +38,12 @@ clonedbranch=$(git -C "$goaldir" rev-parse --abbrev-ref HEAD) rm -rf "$startdir" "$goaldir" if [ "$clonedrepo" != "$GOAL_REPO" ] ; then - echo "test-git-clone-related \"$1\" \"$2\" \"$3\" \"$4\" \"$5\"" + echo "test-git-clone-related.sh \"$1\" \"$2\" \"$3\" \"$4\" \"$5\"" echo "expected repo $GOAL_REPO, got: $clonedrepo" exit 2 fi if [ "$clonedbranch" != "$GOAL_BRANCH" ] ; then - echo "test-git-clone-related \"$1\" \"$2\" \"$3\" \"$4\" \"$5\"" + echo "test-git-clone-related.sh \"$1\" \"$2\" \"$3\" \"$4\" \"$5\"" echo "expected branch $GOAL_BRANCH, got: $clonedbranch" exit 2 fi From 31f90429b5439998867380ced3ba4185d88a7653 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 10 May 2025 21:32:51 -0700 Subject: [PATCH 2/3] Make tests pass when run within a PR --- tests/git-clone-related-test/test-git-clone-related.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/git-clone-related-test/test-git-clone-related.sh b/tests/git-clone-related-test/test-git-clone-related.sh index 404feef..8757b55 100755 --- a/tests/git-clone-related-test/test-git-clone-related.sh +++ b/tests/git-clone-related-test/test-git-clone-related.sh @@ -28,8 +28,14 @@ goaldir=$(mktemp -d 2>/dev/null || mktemp -d -t 'goaldir') rm -rf "$startdir" "$goaldir" git clone --branch "$START_BRANCH" "$START_REPO" "$startdir" -q --single-branch --depth 1 -# $ARGS should not be quoted -# shellcheck disable=SC2086 +# This test might itself be running under CI, so unset the variables that +# `ci-info` examines. +unset SYSTEM_PULLREQUEST_TARGETBRANCH; +unset BUILD_SOURCEBRANCH +unset TRAVIS +unset CIRCLE_COMPARE_URL +unset GITHUB_HEAD_REF +# shellcheck disable=SC2086 # $ARGS should not be quoted (cd "$startdir" && "${PLUME_SCRIPTS}"/git-clone-related $ARGS "$goaldir") clonedrepo=$(git -C "$goaldir" config --get remote.origin.url) # git 2.22 and later has `git branch --show-current`; CircleCI doesn't have that version yet. From 79e0a378677992df349e72bfa3dfd8e006a1df25 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 10 May 2025 21:35:14 -0700 Subject: [PATCH 3/3] Undo a change --- git-clone-related | 2 -- 1 file changed, 2 deletions(-) diff --git a/git-clone-related b/git-clone-related index cffcf6a..3090719 100755 --- a/git-clone-related +++ b/git-clone-related @@ -49,8 +49,6 @@ if [ "$1" = "--debug" ] ; then set -x fi -DEBUG=1 - # FALLBACK_BRANCH may be unset. if [ "$1" = "--upstream-branch" ] ; then shift