pgit.sh: Support --refspec

In the attempt to move away from communicating options via
environment variables from one part of jw-build software to another,
replace PGIT_CLONE_FROM_USER with the clearer --refspec option. Which
is also more versatile.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2025-11-24 10:04:47 +01:00
commit d047ad650c
2 changed files with 32 additions and 21 deletions

View file

@ -116,14 +116,17 @@ endif
PROJECTS_PY = $(TIME) python3 $(JWB_SCRIPT_DIR)/jw-projects.py --prefix $(shell pwd) $(PROJECTS_PY_EXTRA_OPTS)
PROJECTS_PY_BUILD = $(PROJECTS_PY) build $(PROJECTS_PY_EXTRA_BUILD_OPTS)
PGIT_SH = /bin/bash $(JWB_SCRIPT_DIR)/pgit.sh
PGIT_SH_CLONE = $(PGIT_SH) clone
export PGIT_CLONE_FROM_USER = $(CLONE_FROM_USER)
PGIT_SH := /bin/bash $(JWB_SCRIPT_DIR)/pgit.sh
PGIT_SH_CLONE := $(PGIT_SH) clone
PGIT_SH_CLONE_DEFAULT := $(PGIT_SH_CLONE)
ifneq ($(CLONE_FROM_USER),)
PGIT_SH_CLONE_DEFAULT += --refspec $(CLONE_FROM_USER)
endif
ifneq ($(OFFLINE_PROJECTS),)
export PGIT_IGNORE = $(OFFLINE_PROJECTS)
endif
ifneq ($(JANWARE_USER),)
#PGIT_SH_CLONE += --create-remote-user-repos
#PGIT_SH_CLONE_DEFAULT += --create-remote-user-repos
endif
ifneq ($(origin PROJECTS_DIR_REMOTE_BASE),undefined)
PGIT_SH += --remote-base $(PROJECTS_DIR_REMOTE_BASE)
@ -309,20 +312,20 @@ git-status:
git-pull: $(SSH_WRAPPER_SH)
$(PGIT_SH_CLONE)
$(PGIT_SH_CLONE_DEFAULT)
git-pull-mini: $(SSH_WRAPPER_SH)
PGIT_CLONE_PROJECTS="$(patsubst %/.git,%,$(wildcard $(addsuffix /.git,$(shell make -s build-order))))" $(PGIT_SH_CLONE)
PGIT_CLONE_PROJECTS="$(patsubst %/.git,%,$(wildcard $(addsuffix /.git,$(shell make -s build-order))))" $(PGIT_SH_CLONE_DEFAULT)
git-pull-all: $(SSH_WRAPPER_SH)
$(PGIT_SH) pull --all
git-clone: $(SSH_WRAPPER_SH)
$(PGIT_SH_CLONE)
$(PGIT_SH_CLONE_DEFAULT)
touch clone.done
git-clone-%: $(SSH_WRAPPER_SH)
PGIT_CLONE_FROM_USER=$* $(PGIT_SH_CLONE)
$(PGIT_SH_CLONE_DEFAULT)
git-show-non-master-branches:
@$(PGIT_SH) branch 2>&1 | \
@ -343,7 +346,7 @@ git-update-project-descriptions: $(SSH_WRAPPER_SH)
$(GIT_SRV_ADMIN_SH) -j update-descriptions all
git-pull-%: $(SSH_WRAPPER_SH)
PGIT_CLONE_FROM_USER=$* $(PGIT_SH_CLONE)
$(PGIT_SH_CLONE) --refspec "$*:master:master"
git-commit:
$(PGIT_SH) commit
@ -363,5 +366,5 @@ pull.done: $(filter-out $(UNAVAILABLE_TARGETS), clone.done)
touch $@
clone.done: $(filter-out $(UNAVAILABLE_TARGETS),$(SSH_WRAPPER_SH))
$(PGIT_SH_CLONE)
$(PGIT_SH_CLONE_DEFAULT)
touch $@