pgit.sh: Rename command "clone" to "get"

"clone"  in the Git sense means to copy a remote project over from
scratch. pgit.sh clone has come from that, but has since evolved into
something different, a mixture of clone, pull and fetch, so find a
different name. "get" seems generic enough and doesn't clash with a
Git meaning. Adapt variable names accordingly across the project.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-02-21 09:29:11 +01:00
commit f86634a1d1
4 changed files with 38 additions and 43 deletions

View file

@ -77,7 +77,7 @@ OFFLINE_PROJECTS ?= $(EXCLUDE_FROM_BUILD)
TEXT_FILES_CACHE ?= text-files.txt TEXT_FILES_CACHE ?= text-files.txt
ifeq ($(OFFLINE),true) ifeq ($(OFFLINE),true)
UNAVAILABLE_TARGETS ?= pull.done update.done clone.done UNAVAILABLE_TARGETS ?= pull.done update.done get.done
else else
UNAVAILABLE_TARGETS ?= UNAVAILABLE_TARGETS ?=
endif endif
@ -121,19 +121,19 @@ PKG_MANAGER ?= $(JW_PKG_PY) distro --interactive=$(INTERACTIVE)
ifneq ($(origin PROJECTS_DIR_REMOTE_BASE),undefined) ifneq ($(origin PROJECTS_DIR_REMOTE_BASE),undefined)
PGIT_SH += --remote-base $(PROJECTS_DIR_REMOTE_BASE) PGIT_SH += --remote-base $(PROJECTS_DIR_REMOTE_BASE)
endif endif
PGIT_SH_CLONE := $(PGIT_SH) clone PGIT_SH_GET := $(PGIT_SH) get
PGIT_SH_CLONE_DEFAULT = $(PGIT_SH_CLONE) $(PGIT_SH_OPTS_NETWORK) PGIT_SH_GET_DEFAULT = $(PGIT_SH_GET) $(PGIT_SH_OPTS_NETWORK)
ifneq ($(JANWARE_USER),) ifneq ($(JANWARE_USER),)
PGIT_SH_OPTS_NETWORK += --login $(JANWARE_USER) PGIT_SH_OPTS_NETWORK += --login $(JANWARE_USER)
endif endif
ifneq ($(CLONE_FROM_USER),) ifneq ($(CLONE_FROM_USER),)
PGIT_SH_CLONE_DEFAULT += --refspec $(CLONE_FROM_USER):current-branch:current-branch PGIT_SH_GET_DEFAULT += --refspec $(CLONE_FROM_USER):current-branch:current-branch
endif endif
ifneq ($(OFFLINE_PROJECTS),) ifneq ($(OFFLINE_PROJECTS),)
export PGIT_IGNORE = $(OFFLINE_PROJECTS) export PGIT_IGNORE = $(OFFLINE_PROJECTS)
endif endif
ifneq ($(JANWARE_USER),) ifneq ($(JANWARE_USER),)
PGIT_SH_CLONE_DEFAULT += --create-remote-user-repos PGIT_SH_GET_DEFAULT += --create-remote-user-repos
endif endif
PURGE_SH = /bin/bash $(firstword $(wildcard $(JWB_SCRIPT_DIR)/purge-stale-projects.sh $(JW_PKG_BINDIR)/purge-stale-projects.sh) purge-not-found) PURGE_SH = /bin/bash $(firstword $(wildcard $(JWB_SCRIPT_DIR)/purge-stale-projects.sh $(JW_PKG_BINDIR)/purge-stale-projects.sh) purge-not-found)
@ -291,7 +291,7 @@ done.clean:
list-maintainers: $(SSH_WRAPPER_SH) list-maintainers: $(SSH_WRAPPER_SH)
$(GIT_SRV_ADMIN_SH) $@ $(GIT_SRV_ADMIN_SH) $@
update pull: purge git-clone update pull: purge git-get
touch pull.done touch pull.done
sync: pull push sync: pull push
@ -301,13 +301,15 @@ sync-all: pull-all push-all
sync-%: sync-%:
ssh $* make -C $(shell pwd) sync ssh $* make -C $(shell pwd) sync
pull-all: purge git-clone git-pull-all pull-all: purge git-get git-pull-all
touch clone.done touch get.done
touch pull.done touch pull.done
diff-all diff: $(SSH_WRAPPER_SH) diff-all diff: $(SSH_WRAPPER_SH)
$(PGIT_SH) diff $(PGIT_SH) diff
# --- git targets
git-push push: $(SSH_WRAPPER_SH) git-push push: $(SSH_WRAPPER_SH)
$(PGIT_SH) push $(PGIT_SH_OPTS_NETWORK) $(PGIT_SH) push $(PGIT_SH_OPTS_NETWORK)
@ -323,22 +325,18 @@ git-short-diff: $(SSH_WRAPPER_SH)
git-status: git-status:
$(PGIT_SH) status -uno $(PGIT_SH) status -uno
git-get: $(SSH_WRAPPER_SH)
$(PGIT_SH_GET_DEFAULT)
touch get.done
git-pull: $(SSH_WRAPPER_SH) git-get-mini: $(SSH_WRAPPER_SH)
$(PGIT_SH_CLONE_DEFAULT) PGIT_SH_PROJECTS="$(patsubst %/.git,%,$(wildcard $(addsuffix /.git,$(shell make -s build-order))))" $(PGIT_SH_GET_DEFAULT)
git-pull-mini: $(SSH_WRAPPER_SH)
PGIT_CLONE_PROJECTS="$(patsubst %/.git,%,$(wildcard $(addsuffix /.git,$(shell make -s build-order))))" $(PGIT_SH_CLONE_DEFAULT)
git-pull-all: $(SSH_WRAPPER_SH) git-pull-all: $(SSH_WRAPPER_SH)
$(PGIT_SH) pull $(PGIT_SH_OPTS_NETWORK) --all $(PGIT_SH) pull $(PGIT_SH_OPTS_NETWORK) --all
git-clone: $(SSH_WRAPPER_SH) git-get-%: $(SSH_WRAPPER_SH)
$(PGIT_SH_CLONE_DEFAULT) $(PGIT_SH_GET) $(PGIT_SH_OPTS_NETWORK) --refspec "$*:master:master"
touch clone.done
git-clone-%: $(SSH_WRAPPER_SH)
$(PGIT_SH_CLONE_DEFAULT)
git-show-non-master-branches: git-show-non-master-branches:
$(Q)$(PGIT_SH) branch 2>&1 | \ $(Q)$(PGIT_SH) branch 2>&1 | \
@ -366,9 +364,6 @@ git-echo-links-%: | $(TEXT_FILES_CACHE)
git-update-project-descriptions: $(SSH_WRAPPER_SH) git-update-project-descriptions: $(SSH_WRAPPER_SH)
$(GIT_SRV_ADMIN_SH) -j update-descriptions all $(GIT_SRV_ADMIN_SH) -j update-descriptions all
git-pull-%: $(SSH_WRAPPER_SH)
$(PGIT_SH_CLONE) $(PGIT_SH_OPTS_NETWORK) --refspec "$*:master:master"
git-commit: git-commit:
$(PGIT_SH) commit $(PGIT_SH) commit
@ -383,9 +378,9 @@ clean.ssh-wrapper:
rm -f $(SSH_WRAPPER_SH) rm -f $(SSH_WRAPPER_SH)
distclean: clean.ssh-wrapper distclean: clean.ssh-wrapper
pull.done: $(filter-out $(UNAVAILABLE_TARGETS), clone.done) pull.done: $(filter-out $(UNAVAILABLE_TARGETS),get.done)
touch $@ touch $@
clone.done: $(filter-out $(UNAVAILABLE_TARGETS),$(SSH_WRAPPER_SH)) get.done: $(filter-out $(UNAVAILABLE_TARGETS),$(SSH_WRAPPER_SH))
$(PGIT_SH_CLONE_DEFAULT) $(PGIT_SH_GET_DEFAULT)
touch $@ touch $@

View file

@ -239,7 +239,7 @@ SCM_ADD = cvs add
SCM_PUSH = SCM_PUSH =
SCM_PULL = cvs update -dP SCM_PULL = cvs update -dP
pull-maintainer: get-maintainer:
$(SCM_PULL) $(SCM_PULL)
define check_scm_sync define check_scm_sync
@ -266,9 +266,9 @@ else
SCM_COMMIT = git commit SCM_COMMIT = git commit
SCM_ADD = git add SCM_ADD = git add
SCM_PUSH = git push SCM_PUSH = git push
SCM_PULL = make git-pull-maintainer SCM_PULL = make git-get-maintainer
pull-maintainer: git-pull-maintainer get-maintainer: git-get-maintainer
define check_scm_sync define check_scm_sync
echo + checking git ;\ echo + checking git ;\
@ -344,7 +344,7 @@ pkg-rebuild-reinstall: pkg-clean pkg-build pkg-reinstall
# doesn't work # doesn't work
# pkg-release-update: pkg-release pkg-update # pkg-release-update: pkg-release pkg-update
pkg-release-reinstall: pull-maintainer pkg-release-reinstall: get-maintainer
$(PKG_SH) release $(PKG_SH_BUILD_OPTS) $(PKG_SH) release $(PKG_SH_BUILD_OPTS)
ifneq ($(TARGET_HOST),) ifneq ($(TARGET_HOST),)
pkg-remote-install: pkg-remote-install:

View file

@ -197,14 +197,14 @@ git-ssh-%:
bash -c "`git remote get-url --push $* | sed 's|ssh://||; s|\([^/]\+\)/\(.*\)|LC_CDPATH=/\2 ssh -o SendEnv=LC_CDPATH \1|'`" 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-ssh: git-ssh-origin
git-pull-official: git-get-official:
make git-pull-devops make git-get-devops
git-pull-maintainer: git-get-maintainer:
make git-pull-$(call proj_query,getval global jw-maintainer) make git-get-$(call proj_query,getval global jw-maintainer)
git-pull-%: git-get-%:
PGIT_CLONE_PROJECTS=. $(PGIT_SH) clone --refspec $*:$(GIT_MAIN_BRANCH):$(GIT_MAIN_BRANCH) PGIT_SH_PROJECTS=. $(PGIT_SH) get --refspec $*:$(GIT_MAIN_BRANCH):$(GIT_MAIN_BRANCH)
pkg-manager-refresh: pkg-manager-refresh:
$(PKG_MANAGER) refresh $(PKG_MANAGER) refresh

View file

@ -112,7 +112,7 @@ cmd_commit()
done done
) )
cmd_clone() cmd_get()
( (
run_clone() { run_clone() {
local url="$1" local url="$1"
@ -128,7 +128,7 @@ cmd_clone()
local whoami="$(id -un)" local whoami="$(id -un)"
set_global_variables set_global_variables
cd $projects_dir cd $projects_dir
local projects="$PGIT_CLONE_PROJECTS" local projects="$PGIT_SH_PROJECTS"
local ignore="$PGIT_IGNORE" local ignore="$PGIT_IGNORE"
local this_dir="${0%/*}" local this_dir="${0%/*}"
local jw_projects="/usr/bin/python3 $this_dir/jw-pkg.py" local jw_projects="/usr/bin/python3 $this_dir/jw-pkg.py"
@ -138,7 +138,7 @@ cmd_clone()
long_opts="$long_opts,refspec:" long_opts="$long_opts,refspec:"
local opts local opts
opts=$(getopt -o C --long "$long_opts" -n clone -- "$@") || fatal "Failed to parse options $@" opts=$(getopt -o C --long "$long_opts" -n get -- "$@") || fatal "Failed to parse options $@"
eval set -- "$opts" eval set -- "$opts"
while [ "$1" != -- ]; do while [ "$1" != -- ]; do
case "$1" in case "$1" in
@ -189,7 +189,7 @@ cmd_clone()
[ "$to_ref" = "current-branch" ] && to_ref=$cur_ref [ "$to_ref" = "current-branch" ] && to_ref=$cur_ref
[ "$from_ref" = "current-branch" ] && from_ref=$cur_ref [ "$from_ref" = "current-branch" ] && from_ref=$cur_ref
[ "$refspec_arg" != "$from_user:$from_ref:$to_ref" ] && log "Fetching $from_user:$from_ref:$to_ref ($refspec_arg)" [ "$refspec_arg" != "$from_user:$from_ref:$to_ref" ] && log "Fetching $from_user:$from_ref:$to_ref ($refspec_arg)"
fat_marker "Fetching project $project_name from user $from_user" fat_marker "Getting project $project_name from user $from_user"
if [ -d $project_dir ]; then if [ -d $project_dir ]; then
run_git -C $project_dir remote | grep -q "^$remote_name$" || { run_git -C $project_dir remote | grep -q "^$remote_name$" || {
run_git -C $project_dir remote add $remote_name $pull_url run_git -C $project_dir remote add $remote_name $pull_url
@ -272,7 +272,7 @@ while [ "${1:0:1}" = - ]; do
done done
case $cmd in case $cmd in
clone|diff|commit) get|diff|commit)
cmd_${cmd//-/_} "$@" cmd_${cmd//-/_} "$@"
;; ;;
*) *)