mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 17:23:36 +02:00
pgit.sh get: Fix default revision for fresh clones
Fix detection of a project's revision if a project directory is freshly cloned, and hence doesn't exist, yet. The fix is to default to master for now.
This commit is contained in:
parent
404901bcff
commit
f55a32024b
1 changed files with 10 additions and 1 deletions
|
|
@ -145,6 +145,15 @@ cmd_get()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
project_current_revision() {
|
||||||
|
local dir="$1"
|
||||||
|
if [ -d $dir ]; then
|
||||||
|
git -C $dir rev-parse --abbrev-ref HEAD
|
||||||
|
else
|
||||||
|
echo master
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
local remote_base="$global_remote_base"
|
local remote_base="$global_remote_base"
|
||||||
local remote_subpath="$global_remote_subpath"
|
local remote_subpath="$global_remote_subpath"
|
||||||
local whoami="$(id -un)"
|
local whoami="$(id -un)"
|
||||||
|
|
@ -202,7 +211,7 @@ cmd_get()
|
||||||
cur=`expr $cur + 1`
|
cur=`expr $cur + 1`
|
||||||
local pull_url=$remote_base/$from_user$remote_subpath/$project_name
|
local pull_url=$remote_base/$from_user$remote_subpath/$project_name
|
||||||
local push_url=$remote_base/$remote_user$remote_subpath/$project_name
|
local push_url=$remote_base/$remote_user$remote_subpath/$project_name
|
||||||
local cur_ref=$(git -C $project_dir rev-parse --abbrev-ref HEAD)
|
local cur_ref=$(project_current_revision $project_dir)
|
||||||
local remote_name="jw-$from_user"
|
local remote_name="jw-$from_user"
|
||||||
local from_ref="${refspec[1]}"
|
local from_ref="${refspec[1]}"
|
||||||
local to_ref="${refspec[2]}"
|
local to_ref="${refspec[2]}"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue