mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
pgit.sh: Support --login
In the move away from environment variables, replace JANWARE_USER support in pgit.sh by the --login option. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
d047ad650c
commit
f9f0041790
2 changed files with 15 additions and 8 deletions
|
|
@ -118,7 +118,10 @@ PROJECTS_PY_BUILD = $(PROJECTS_PY) build $(PROJECTS_PY_EXTRA_BUILD_OP
|
|||
|
||||
PGIT_SH := /bin/bash $(JWB_SCRIPT_DIR)/pgit.sh
|
||||
PGIT_SH_CLONE := $(PGIT_SH) clone
|
||||
PGIT_SH_CLONE_DEFAULT := $(PGIT_SH_CLONE)
|
||||
PGIT_SH_CLONE_DEFAULT = $(PGIT_SH_CLONE) $(PGIT_SH_OPTS_NETWORK)
|
||||
ifneq ($(JANWARE_USER),)
|
||||
PGIT_SH_OPTS_NETWORK += --login $(JANWARE_USER)
|
||||
endif
|
||||
ifneq ($(CLONE_FROM_USER),)
|
||||
PGIT_SH_CLONE_DEFAULT += --refspec $(CLONE_FROM_USER)
|
||||
endif
|
||||
|
|
@ -296,10 +299,10 @@ diff-all diff: $(SSH_WRAPPER_SH)
|
|||
$(PGIT_SH) diff
|
||||
|
||||
git-push push: $(SSH_WRAPPER_SH)
|
||||
$(PGIT_SH) push
|
||||
$(PGIT_SH) push $(PGIT_SH_OPTS_NETWORK)
|
||||
|
||||
git-push-all: $(SSH_WRAPPER_SH)
|
||||
$(PGIT_SH) push --all --recurse-submodules=on-demand
|
||||
$(PGIT_SH) push $(PGIT_SH_OPTS_NETWORK) --all --recurse-submodules=on-demand
|
||||
|
||||
git-diff: $(SSH_WRAPPER_SH)
|
||||
$(PGIT_SH) diff
|
||||
|
|
@ -318,7 +321,7 @@ 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)
|
||||
$(PGIT_SH) pull --all
|
||||
$(PGIT_SH) pull $(PGIT_SH_OPTS_NETWORK) --all
|
||||
|
||||
git-clone: $(SSH_WRAPPER_SH)
|
||||
$(PGIT_SH_CLONE_DEFAULT)
|
||||
|
|
@ -346,7 +349,7 @@ git-update-project-descriptions: $(SSH_WRAPPER_SH)
|
|||
$(GIT_SRV_ADMIN_SH) -j update-descriptions all
|
||||
|
||||
git-pull-%: $(SSH_WRAPPER_SH)
|
||||
$(PGIT_SH_CLONE) --refspec "$*:master:master"
|
||||
$(PGIT_SH_CLONE) $(PGIT_SH_OPTS_NETWORK) --refspec "$*:master:master"
|
||||
|
||||
git-commit:
|
||||
$(PGIT_SH) commit
|
||||
|
|
|
|||
|
|
@ -101,9 +101,9 @@ clone()
|
|||
}
|
||||
|
||||
local p
|
||||
local whoami="$(id -un)"
|
||||
config
|
||||
cd $pdir
|
||||
local login=$JANWARE_USER
|
||||
local projects="$PGIT_CLONE_PROJECTS"
|
||||
local ignore="$PGIT_IGNORE"
|
||||
local thisdir="${0%/*}"
|
||||
|
|
@ -112,6 +112,8 @@ clone()
|
|||
local long_opts="create-remote-user-repos"
|
||||
local refspec=()
|
||||
long_opts="$long_opts,refspec:"
|
||||
local login="$whoami"
|
||||
long_opts="$long_opts,login:"
|
||||
|
||||
local opts
|
||||
opts=$(getopt -o C --long "$long_opts" -n clone -- "$@") || fatal "Failed to parse options $@"
|
||||
|
|
@ -125,6 +127,10 @@ clone()
|
|||
refspec=(${2//:/ })
|
||||
shift
|
||||
;;
|
||||
--login)
|
||||
login="$2"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
fatal "Unknown option $1"
|
||||
;;
|
||||
|
|
@ -136,8 +142,6 @@ clone()
|
|||
local fromuser="${refspec[0]}"
|
||||
local fromref="${refspec[1]}"
|
||||
local toref="${refspec[2]}"
|
||||
local whoami="$(id -un)"
|
||||
[ "$login" ] || login=$whoami
|
||||
[ "$fromuser" ] || fromuser=$whoami
|
||||
[ "$fromref" ] || fromref=master
|
||||
local git_srv_admin="$SSH $login@git.janware.com /opt/jw-build/bin/git-srv-admin.sh"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue