From 7b48206ea5696889b01358f71dc5a18943bcacfb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 13 Aug 2025 10:44:14 +0000 Subject: [PATCH 1/2] Initial plan From ad4870c79b97790e0cefafdc6fb7f72cb8689400 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 13 Aug 2025 11:00:08 +0000 Subject: [PATCH 2/2] Fix conditional stash pop in test.sh script - Capture git stash push output to detect if stash was created - Only run git stash pop if a stash was actually created - Prevents popping unrelated stashes when no changes exist - Maintains same output formatting and user experience Co-authored-by: RichDom2185 <34370238+RichDom2185@users.noreply.github.com> --- scripts/test.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/scripts/test.sh b/scripts/test.sh index 8fd5fb8765..97255a89e4 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -3,9 +3,19 @@ export CI=true main() { - run_cmd "git stash push --keep-index --message precommit" - echo " If you cancel this pre-push hook, use \`git stash pop\` to retrieve your" - echo " unstaged changes." + stash_output=$(git stash push --keep-index --message precommit 2>&1) + echo_cyan "> git stash push --keep-index --message precommit" + if [[ ! -z "${stash_output}" ]]; then + echo "${stash_output}" | sed 's/^/ /' + fi + + # Check if a stash was actually created + stash_created=false + if [[ "${stash_output}" == *"Saved working directory"* ]]; then + stash_created=true + echo " If you cancel this pre-push hook, use \`git stash pop\` to retrieve your" + echo " unstaged changes." + fi tsc="yarn run tsc" eslint="yarn run eslint" @@ -19,7 +29,10 @@ main() { run_cmd "${prettier_scss}"; prettier_scss_exit=$? run_cmd_jest "${jest_ts}"; jest_ts_exit=$? - run_cmd "git stash pop" + # Only pop the stash if we actually created one + if [[ "${stash_created}" == true ]]; then + run_cmd "git stash pop" + fi ( >&2 echo -ne "\033[0;31m"