topdir.mk: Add targets git-pull-% and git-pull-maintainer

git-pull-% pulls whatever $(GIT_MAIN_BRANCH) happens to be
from the remote jw-% into the current branch, with --rebase and
--autostash.

git-pull-maintainer does the same with <maintainer>.  <maintainer> is
figured out from the configuration in projects.conf. If it's the
invoking user, origin is used.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2025-11-24 11:22:56 +01:00
commit bf86f6c625

View file

@ -18,6 +18,7 @@ endif
PROJECT_DESCR = $(TOPDIR)/make/project.conf
GIT_DESCR = $(TOPDIR)/.git/description
GIT_MAIN_BRANCH ?= master
OPT_JANWARE_PROJECT ?= -j
PKG_MANAGER_SH ?= /bin/bash $(firstword $(wildcard $(JWB_SCRIPT_DIR)/pkg-manager.sh /opt/jw-build/bin/pkg-manager.sh) pkg-manager-not-found)
@ -145,7 +146,7 @@ git-config:
git-clone-to-remote:
ssh $(JANWARE_USER)@git.janware.com "/opt/jw-build/bin/git-srv-admin.sh $(OPT_JANWARE_PROJECT) create-personal-project $(PROJECT)"
make git-config
git push --set-upstream origin master
git push --set-upstream origin $(GIT_MAIN_BRANCH)
git push --all $(REMOTE_GIT_URL)
make git-update-project-description
@ -194,6 +195,16 @@ git-ssh-%:
bash -c "`git remote get-url --push $* | sed 's|ssh://||; s|\([^/]\+\)/\(.*\)|LC_CDPATH=/\2 ssh -o SendEnv=LC_CDPATH \1|'`"
git-ssh: git-ssh-origin
git-pull-maintainer:
make git-pull-$(call proj_query,getval global jw-maintainer)
git-pull-%:
if [ "$*" = "$(JANWARE_USER)" ]; then \
git pull origin $(GIT_MAIN_BRANCH) ;\
else \
git pull --rebase --autostash jw-$* $(GIT_MAIN_BRANCH) ;\
fi
pkg-manager-refresh:
$(PKG_MANAGER_SH) refresh $(DASH_Y)