From a90239dd010c8a4ec19c48f4de6fbae2ad54c527 Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Mon, 5 Sep 2022 16:06:49 -0500 Subject: [PATCH] [wip] `make testground` should work when working tree is clean --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 7a18a47c..ab75f4e6 100644 --- a/Makefile +++ b/Makefile @@ -134,9 +134,9 @@ TESTGROUND_TESTCASE ?= hello testground: mkdir -p scratch && rm -rf scratch/* && git clone --depth=1 "file://$${PWD}" "scratch/$$(basename $${PWD})" - git diff --merge-base HEAD > "scratch/$$(basename $${PWD})/scratch.patch" - cd "scratch/$$(basename $${PWD})" && git apply scratch.patch - rm "scratch/$$(basename $${PWD})/scratch.patch" + [[ $$(git status --porcelain) == "" ]] || (git diff --merge-base HEAD > "scratch/$$(basename $${PWD})/scratch.patch") + [[ $$(git status --porcelain) == "" ]] || (cd "scratch/$$(basename $${PWD})" && git apply scratch.patch) + rm -f "scratch/$$(basename $${PWD})/scratch.patch" git clean -ndfx | grep -v $(SCRATCH_IGNORE) | awk '{ print $$3 }' | xargs -I{} bash -c "test -d '{}' && echo '{}' || true" | xargs -I{} mkdir -p scratch/nim-codex/{} git clean -ndfx | grep -v $(SCRATCH_IGNORE) | awk '{ print $$3 }' | xargs -I{} cp -R {} scratch/nim-codex/{} testground plan import --from=testground/$(TESTGROUND_PLAN)