From 9790c3c33620cced23293d47b73a3ea7e871460e Mon Sep 17 00:00:00 2001 From: RealStickman Date: Mon, 4 Jul 2022 20:18:31 +0200 Subject: [PATCH] Disable error output for git. Add check for both operations --- arch-config/scripts/in_path/sc-git-pull | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch-config/scripts/in_path/sc-git-pull b/arch-config/scripts/in_path/sc-git-pull index 892600c0..c968239b 100755 --- a/arch-config/scripts/in_path/sc-git-pull +++ b/arch-config/scripts/in_path/sc-git-pull @@ -17,8 +17,13 @@ for dir in "${dirs[@]}"; do # change into that directory cd "$dir" # try to check out master or main branch - git checkout -q master \ - || git checkout -q main + git checkout -q master 2>/dev/null \ + || git checkout -q main 2>/dev/null + # check whether the previous two commands failed + if [ $? -ne 0 ]; then + printf "Couldn't find master or main branches\n" + exit 1 + fi git fetch --all git pull done