From c194f92ca29c215bb09589820b91405fe5d3513f Mon Sep 17 00:00:00 2001 From: IVA2K Date: Wed, 7 Feb 2024 09:36:16 -0800 Subject: [PATCH] Add check that working folder is clean to git-run-all-in-branches.sh --- scripts/git-run-all-in-branches.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/git-run-all-in-branches.sh b/scripts/git-run-all-in-branches.sh index fc252565..4b753fca 100644 --- a/scripts/git-run-all-in-branches.sh +++ b/scripts/git-run-all-in-branches.sh @@ -40,6 +40,17 @@ function decolor() { } function main() { + # Check that local repo is clean + output=$(git status --untracked-files=no --porcelain 2>&1) + if [ "$?" -ne 0 ] || [ ! -z "$output" ]; then + # Working directory clean excluding untracked files + echo "Working folder is not clean. Please clean working folder and retry." + echo "$output" + return 1 + else + echo "Working folder is clean." + fi + outputs=() errors=() for i in "${!TARGET_BRANCHES[@]}"; do