From b35d8bb5c9dda367eed9a635467a05178c5a7ba7 Mon Sep 17 00:00:00 2001 From: bebbo Date: Thu, 27 Apr 2023 10:39:34 +0200 Subject: [PATCH] update branch if mod is not yet checked out --- Makefile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 3ecb515..45739b9 100644 --- a/Makefile +++ b/Makefile @@ -1073,11 +1073,13 @@ branch: mv .repos .repos.bak; \ grep -v $(mod) .repos.bak > .repos; \ echo "$(mod) $$url $(branch)" >> .repos; \ - pushd projects/$(mod); \ - git fetch origin $(branch):$(branch); \ - git checkout $(branch); \ - git branch --set-upstream-to=origin/$(branch) $(branch); \ - popd ; \ + if [ -d projects/$(mod) ]; then \ + pushd projects/$(mod); \ + git fetch origin $(branch):$(branch); \ + git checkout $(branch); \ + git branch --set-upstream-to=origin/$(branch) $(branch); \ + popd ; \ + fi \ else \ echo "$(mod) $(branch) does NOT exist!"; \ fi