-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#16 Update app API usage base on new APIs and add push script
- Loading branch information
Showing
2 changed files
with
106 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#! /bin/bash | ||
|
||
usedBranch="" | ||
|
||
branches=`git branch` | ||
oldIFS="$IFS" | ||
IFS=' | ||
' | ||
lines=( $branches ) | ||
IFS="$oldIFS" | ||
|
||
branch="" | ||
for line in "${lines[@]}" | ||
do | ||
isCurrentBranch=false | ||
#t=`expr substr "$line" 1 1` | ||
t=${line:0:1} | ||
if [ "$t" = "*" ] | ||
then | ||
isCurrentBranch=true | ||
fi | ||
#branch=`expr substr "$line" 3 "${#line}"` | ||
branch=${line:2} | ||
if test -z "$1" | ||
then | ||
if [ "$isCurrentBranch" = true ] | ||
then | ||
usedBranch="$branch" | ||
break | ||
fi | ||
else | ||
if [ "$1" = "$branch" ] | ||
then | ||
usedBranch="$branch" | ||
break | ||
fi | ||
fi | ||
done | ||
|
||
if test -z "$usedBranch" | ||
then | ||
if test -z "$1" | ||
then | ||
echo "Push failed: working branch was not found, are you under gir repository?" | ||
echo "Usage: push [branch name]" | ||
exit 1 | ||
else | ||
echo "Push failed: specified branch is not valid - $1" | ||
echo "Usage: push [branch name]" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
repositories=`git remote` | ||
for repository in ${repositories[@]} | ||
do | ||
echo ">>> push change to $repository for branch $usedBranch <<<" | ||
git push $repository $1 | ||
done | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters