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

@ -112,7 +112,7 @@ cmd_commit()
done
)
cmd_clone()
cmd_get()
(
run_clone() {
local url="$1"
@ -128,7 +128,7 @@ cmd_clone()
local whoami="$(id -un)"
set_global_variables
cd $projects_dir
local projects="$PGIT_CLONE_PROJECTS"
local projects="$PGIT_SH_PROJECTS"
local ignore="$PGIT_IGNORE"
local this_dir="${0%/*}"
local jw_projects="/usr/bin/python3 $this_dir/jw-pkg.py"
@ -138,7 +138,7 @@ cmd_clone()
long_opts="$long_opts,refspec:"
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"
while [ "$1" != -- ]; do
case "$1" in
@ -189,7 +189,7 @@ cmd_clone()
[ "$to_ref" = "current-branch" ] && to_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)"
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
run_git -C $project_dir remote | grep -q "^$remote_name$" || {
run_git -C $project_dir remote add $remote_name $pull_url
@ -272,7 +272,7 @@ while [ "${1:0:1}" = - ]; do
done
case $cmd in
clone|diff|commit)
get|diff|commit)
cmd_${cmd//-/_} "$@"
;;
*)