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

gpush: add some heroustic for default behavior

parent 27822c7f
...@@ -6,13 +6,13 @@ load_mod git ...@@ -6,13 +6,13 @@ load_mod git
test -r "$1" && fatal "Do not need any files in params" test -r "$1" && fatal "Do not need any files in params"
# If run with remote alias like girar name, use only it
if is_girar_name $1 ; then if is_girar_name $1 ; then
GIRARHOST=$1 GIRARHOST=$1
OVERRIDEGIRARHOST=$1 OVERRIDEGIRARHOST=$1
shift shift
fi fi
if [ "$1" = "-h" ] ; then if [ "$1" = "-h" ] ; then
echo "gpush - publish current project repo remote git repo" echo "gpush - publish current project repo remote git repo"
echo "Use: gpush [GIRAR] [-f|--force] [-a|--all] [-t|--tags] [target branch]" echo "Use: gpush [GIRAR] [-f|--force] [-a|--all] [-t|--tags] [target branch]"
...@@ -39,11 +39,10 @@ fi ...@@ -39,11 +39,10 @@ fi
REMOTELIST="$(get_remote_git_list)" REMOTELIST="$(get_remote_git_list)"
# disable use one target if it one # use one target if it one
if false && is_one_girar_name "$REMOTELIST" ; then if is_one_girar_name "$REMOTELIST" && [ -z "$OVERRIDEGIRARHOST" ] ; then
GIRARHOST="$REMOTELIST" GIRARHOST="$REMOTELIST"
OVERRIDEGIRARHOST=$GIRARHOST OVERRIDEGIRARHOST=$GIRARHOST
shift
fi fi
# use as project name # use as project name
...@@ -61,7 +60,7 @@ if [ -z "$CURRENTBRANCH" ] ; then ...@@ -61,7 +60,7 @@ if [ -z "$CURRENTBRANCH" ] ; then
exit 1 exit 1
fi fi
if [ "$1" = "origin" ] ; then if [ "$1" = "origin" ]; then
REPO="$1" REPO="$1"
shift shift
git push $PUSHALL $PUSHFORCE $REPO $@ git push $PUSHALL $PUSHFORCE $REPO $@
...@@ -69,6 +68,13 @@ if [ "$1" = "origin" ] ; then ...@@ -69,6 +68,13 @@ if [ "$1" = "origin" ] ; then
exit exit
fi fi
if [ "$(git remote | uniq)" = "origin" ] ; then
REPO="origin"
git push $PUSHALL $PUSHFORCE $REPO $@
git push --tags $PUSHALL $PUSHFORCE $REPO $@
exit
fi
if [ -n "$1" ] ; then if [ -n "$1" ] ; then
TARGETBRANCH="$1" TARGETBRANCH="$1"
shift shift
......
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