From 1242857a75d91b099a6af90b8626a6c0d99bd016 Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Wed, 30 Mar 2022 22:33:08 +0200 Subject: [PATCH] BLFS/Makefile: Don't run git checkout if {B,}LFS-BRANCH is empty Fix also the order of checkout trunk and checkout $(...-BRANCH) --- BLFS/Makefile | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/BLFS/Makefile b/BLFS/Makefile index 6ed9c61..590bfa3 100644 --- a/BLFS/Makefile +++ b/BLFS/Makefile @@ -191,31 +191,38 @@ all: update $(BOOK_XML) # trunk before updating, and switch back to the branch/tag afterwards update: $(BLFS_XML) $(LFS_XML) @echo Updating the book sources +ifneq (,$(LFS-BRANCH)) $(Q)cd $(LFS_XML) && \ - if [ $(LFS-BRANCH) != trunk ]; then git switch -; fi && \ + git checkout trunk && \ git pull && \ - git checkout $(LFS-BRANCH) + if [ $(LFS-BRANCH) != trunk ]; then git checkout $(LFS-BRANCH); fi +endif +ifneq (,$(BLFS-BRANCH)) $(Q)cd $(BLFS_XML) && \ - if [ $(BLFS-BRANCH) != trunk ]; then git switch -; fi && \ + git checkout trunk && \ git pull && \ - git checkout $(BLFS-BRANCH) + if [ $(BLFS-BRANCH) != trunk ]; then git checkout $(BLFS-BRANCH); fi +endif $(LFS_XML): @echo Getting the LFS book sources... $(Q)git clone $(LFS-GIT) $@ +ifneq (,$(LFS-BRANCH)) if [ $(LFS-BRANCH) != trunk ]; then \ cd $@ && \ git checkout $(LFS-BRANCH); \ fi +endif $(BLFS_XML): @echo Getting the BLFS book sources... $(Q)git clone $(GIT) $@ +ifneq (,$(BLFS-BRANCH)) $(Q)if [ $(BLFS-BRANCH) != trunk ]; then \ cd $@ && \ git checkout $(BLFS-BRANCH); \ fi - +endif # Clean up clean: