Commit 7bb3a2be authored by Vitaly Lipatov's avatar Vitaly Lipatov

move some funcs to functions/git

parent 82fecc93
...@@ -258,27 +258,17 @@ get_all_remote_branches() ...@@ -258,27 +258,17 @@ get_all_remote_branches()
docmd git checkout sisyphus || docmd git checkout master || docmd git checkout $CURRENTBRANCH docmd git checkout sisyphus || docmd git checkout master || docmd git checkout $CURRENTBRANCH
} }
has_ssh_access()
{
ssh $GIRARHOST help >/dev/null 2>&1
}
git_clone() git_clone()
{ {
local RREPO="$1" local RREPO="$1"
# Test if ssh access is available # Test if ssh access is available
if [ -z "$PUBLICACCESS" ] && has_ssh_access ; then if [ -z "$PUBLICACCESS" ] && has_ssh_girar_access ; then
docmd git clone $GIRARHOST:$RREPO docmd git clone $GIRARHOST:$RREPO
else else
docmd git clone $GIRARURL/$RREPO docmd git clone $GIRARURL/$RREPO
fi fi
} }
exist_git_repo()
{
ssh $GIRARHOST ls $1 >/dev/null 2>&1
}
# clone remote git # clone remote git
if [ -n "$CLONEGIT" ] ; then if [ -n "$CLONEGIT" ] ; then
# http://git.altlinux.org/gears/N/NAME.git # http://git.altlinux.org/gears/N/NAME.git
...@@ -300,13 +290,13 @@ if [ -n "$CLONEGIT" ] ; then ...@@ -300,13 +290,13 @@ if [ -n "$CLONEGIT" ] ; then
fi fi
else else
[ -z "$PUBLICACCESS" ] || fatal "Can't remote clone via public access" [ -z "$PUBLICACCESS" ] || fatal "Can't remote clone via public access"
if exist_git_repo $RREPO ; then if is_exist_git_repo $RREPO ; then
echo "Remote clone from $RREPO ..." echo "Remote clone from $RREPO ..."
docmd ssh $GIRARHOST clone $RREPO packages/$PKGNAME.git || warning "Can't remote clone." docmd ssh $GIRARHOST clone $RREPO packages/$PKGNAME.git || warning "Can't remote clone."
else else
# http://git.altlinux.org/srpms/N/NAME.git # http://git.altlinux.org/srpms/N/NAME.git
RREPO="/srpms/$REPOPATH" RREPO="/srpms/$REPOPATH"
if exist_git_repo $RREPO ; then if is_exist_git_repo $RREPO ; then
echo "Remote clone from $RREPO ..." echo "Remote clone from $RREPO ..."
docmd ssh $GIRARHOST clone $RREPO packages/$PKGNAME.git || warning "Can't remote clone." docmd ssh $GIRARHOST clone $RREPO packages/$PKGNAME.git || warning "Can't remote clone."
else else
......
...@@ -42,6 +42,20 @@ get_remote_git_list() ...@@ -42,6 +42,20 @@ get_remote_git_list()
} }
# Is allow connect with ssh to the GIRARHOST server?
has_ssh_girar_access()
{
ssh $GIRARHOST help >/dev/null 2>&1
}
# Returns true if repo with path from first arg is exits on the remote GIRARHOST server
is_exist_git_repo()
{
ssh $GIRARHOST ls $1 >/dev/null 2>&1
}
# Check if $1 like git.alt or git.eter, git.something # Check if $1 like git.alt or git.eter, git.something
is_girar_name() is_girar_name()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment