diff --git a/scripts/pgit.sh b/scripts/pgit.sh index d29aba16..d26e544f 100644 --- a/scripts/pgit.sh +++ b/scripts/pgit.sh @@ -145,6 +145,15 @@ cmd_get() 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_subpath="$global_remote_subpath" local whoami="$(id -un)" @@ -202,7 +211,7 @@ cmd_get() cur=`expr $cur + 1` local pull_url=$remote_base/$from_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 from_ref="${refspec[1]}" local to_ref="${refspec[2]}"