Skip to content

Commit

Permalink
change `` to $()
Browse files Browse the repository at this point in the history
  • Loading branch information
Fmajor committed Aug 11, 2020
1 parent fb083c0 commit af7a2a3
Show file tree
Hide file tree
Showing 22 changed files with 63 additions and 298 deletions.
12 changes: 0 additions & 12 deletions gg-ck
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
#!/bin/bash
#
# (__) gg
# (oo)
# /------\/ Distributed under
# / | || the GNU GPL v3 License
# * /\---/\
# ~~ ~~ http://www.gnu.org
#
#
# 2014-08-02
#
# Author: [email protected]
installPath=/usr/local/bin/gg
source $installPath/gg-functions
testClear
Expand Down
12 changes: 0 additions & 12 deletions gg-comment
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
#!/bin/bash
#
# (__) gg
# (oo)
# /------\/ Distributed under
# / | || the GNU GPL v3 License
# * /\---/\
# ~~ ~~ http://www.gnu.org
#
#
# 2014-08-02
#
# Author: [email protected]
installPath=/usr/local/bin/gg
source $installPath/gg-functions
testClear
Expand Down
12 changes: 0 additions & 12 deletions gg-create-new-develop-branch-pair
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
#!/bin/bash
#
# (__) gg
# (oo)
# /------\/ Distributed under
# / | || the GNU GPL v3 License
# * /\---/\
# ~~ ~~ http://www.gnu.org
#
#
# 2014-08-02
#
# Author: [email protected]
installPath=/usr/local/bin/gg
source $installPath/gg-functions
testClear
Expand Down
18 changes: 3 additions & 15 deletions gg-feature-close
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
#!/bin/bash
#
# (__) gg
# (oo)
# /------\/ Distributed under
# / | || the GNU GPL v3 License
# * /\---/\
# ~~ ~~ http://www.gnu.org
#
#
# 2014-08-02
#
# Author: [email protected]
installPath=/usr/local/bin/gg
source $installPath/gg-functions
testClear
Expand All @@ -24,10 +12,10 @@ if [[ $currentBranchType != 'feature' ]]; then
fi

get_father
if [[ -z `git branch | grep -v $currentBranch | grep $father` ]]; then
if [[ -z "$(git branch | grep -v $currentBranch | grep $father)" ]]; then
get_develop
echo "do not know which branch to merge into, please input[default is $develop]:"
git branch
git --no-pagger branch
read temp
if [[ -z $temp ]]; then
father=$develop
Expand All @@ -48,4 +36,4 @@ git checkout "$father"
git merge --no-ff "$currentBranch" -m "Merge feature branch $currentBranch into $father"\
&& echo "press Enter to delete $currentBranch branch"\
&& echo " press Ctrl+c not to delete it"\
&& read temp && git branch -d "$currentBranch"
&& read temp && git branch -d "$currentBranch"
15 changes: 1 addition & 14 deletions gg-feature-open
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
#!/bin/bash
#
# (__) gg
# (oo)
# /------\/ Distributed under
# / | || the GNU GPL v3 License
# * /\---/\
# ~~ ~~ http://www.gnu.org
#
#
# 2014-08-02
#
# Author: [email protected]
installPath=/usr/local/bin/gg
source $installPath/gg-functions
testClear


get_currentBranch
get_currentBranchType
if [[ $currentBranchType == 'master' && $currentBranchType == 'release' ]]; then
Expand All @@ -42,4 +29,4 @@ printf "Do you what to open a new feature branch like this?\n"
gggttt;echo "git checkout -b \"$feature/$1$postfix\""
echo "press ENTER to continue, press Ctrl+c to ESCAPE"
read temp
git checkout -b "$feature/$1$postfix"
git checkout -b "$feature/$1$postfix"
12 changes: 0 additions & 12 deletions gg-feature-update
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
#!/bin/bash
#
# (__) gg
# (oo)
# /------\/ Distributed under
# / | || the GNU GPL v3 License
# * /\---/\
# ~~ ~~ http://www.gnu.org
#
#
# 2014-08-02
#
# Author: [email protected]
installPath=/usr/local/bin/gg
source $installPath/gg-functions
testClear
Expand Down
2 changes: 1 addition & 1 deletion gg-find-big-files
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ rm bashTempOutput.txt bashTempOutput2.txt
printf "Do you what to delete the result data?\n"
echo "press Ctrl+c to ESCAPE"
read temp
rm files.dat
rm files.dat
84 changes: 40 additions & 44 deletions gg-functions
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,39 @@ genDebugLog(){
}

get_currentBranch(){
#currentBranch=`git status | grep On\ branch | awk '{print $3 }'`
#currentBranch=`git status | grep On\ branch | sed 's#On\ branch\ \(.*\)$#\1#'|sed "s#|#\\\|#g"`
currentBranch=`git rev-parse --abbrev-ref HEAD`
currentBranch=$(git rev-parse --abbrev-ref HEAD) # in case of detached HEAD state
if [[ $currentBranch == "HEAD" ]]; then
pointer=1
currentBranch=`git rev-parse HEAD`
currentBranch=$(git rev-parse HEAD)
currentBranch=${currentBranch:0:7}
fi
}
get_isTrialBranch(){
isTrialBranch=$(echo $currentBranch|grep %) # only trial branch have %
}
get_currentBranchType(){
get_currentBranch
if [[ -n "$pointer" ]]; then
currentBranchType="pointer"
currentBranchType="pointer" # detached HEAD state
return
fi
get_isTrialBranch
if [[ -z $isTrialBranch ]]; then # not the trialBranch
if [[ -n `echo $currentBranch | grep -- "-FromBranch-"` ]]; then
temp=`echo ${currentBranch%%-FromBranch-*} | grep issues` ;[[ -n "$temp" ]] && currentBranchType="issues" && return
temp=`echo ${currentBranch%%-FromBranch-*} | grep feature`;[[ -n "$temp" ]] && currentBranchType="feature"&& return
if [[ -z "$isTrialBranch" ]]; then # not the trialBranch
if [[ -n $(echo $currentBranch | grep -- "-FromBranch-") ]]; then
temp=$(echo ${currentBranch%%-FromBranch-*} | grep issues) ;[[ -n "$temp" ]] && currentBranchType="issues" && return
temp=$(echo ${currentBranch%%-FromBranch-*} | grep feature);[[ -n "$temp" ]] && currentBranchType="feature"&& return
fi
temp=`echo $currentBranch | grep \/`
temp=$(echo $currentBranch | grep \/)
if [[ -n "$temp" ]]; then # have a "/" struct
currentBranchTypeAll=`echo $currentBranch|sed 's#\([^/]*\)\/.*#\1#'`
temp=`echo $currentBranchTypeAll | grep issues` ;[[ -n "$temp" ]] && currentBranchType="issues" && return
temp=`echo $currentBranchTypeAll | grep feature`;[[ -n "$temp" ]] && currentBranchType="feature"&& return
currentBranchTypeAll=$(echo $currentBranch|sed 's#\([^/]*\)\/.*#\1#')
temp=$(echo $currentBranchTypeAll | grep issues) ;[[ -n "$temp" ]] && currentBranchType="issues" && return
temp=$(echo $currentBranchTypeAll | grep feature);[[ -n "$temp" ]] && currentBranchType="feature"&& return
else # do not have a "/" struct
currentBranchTypeAll=$currentBranch
temp=`echo $currentBranchTypeAll | grep release`;[[ -n "$temp" ]] && currentBranchType="release"&& return
temp=`echo $currentBranchTypeAll | grep hotfix` ;[[ -n "$temp" ]] && currentBranchType="hotfix" && return
temp=`echo $currentBranchTypeAll | grep master` ;[[ -n "$temp" ]] && currentBranchType="master" && return
temp=`echo $currentBranchTypeAll | grep develop`;[[ -n "$temp" ]] && currentBranchType="develop"&& return
temp=$(echo $currentBranchTypeAll | grep release);[[ -n "$temp" ]] && currentBranchType="release"&& return
temp=$(echo $currentBranchTypeAll | grep hotfix) ;[[ -n "$temp" ]] && currentBranchType="hotfix" && return
temp=$(echo $currentBranchTypeAll | grep master) ;[[ -n "$temp" ]] && currentBranchType="master" && return
temp=$(echo $currentBranchTypeAll | grep develop);[[ -n "$temp" ]] && currentBranchType="develop"&& return
fi
else # it is a trialBranch
currentBranchType="trial"&& return
Expand All @@ -53,25 +54,25 @@ get_currentBranchType(){

get_father() {
get_currentBranchType
if [[ $currentBranchType == 'issues' || $currentBranchType == 'feature' ]]; then
father=`echo $currentBranch | grep -- '-FromBranch-'`
if [[ $currentBranchType == "issues" || $currentBranchType == "feature" ]]; then
father=$(echo $currentBranch | grep -- '-FromBranch-')
if [[ -z $father ]]; then
get_develop
father=$develop
else
father=`echo ${currentBranch#*-FromBranch-}`
father=$(echo ${currentBranch#*-FromBranch-})
fi
elif [[ $currentBranchType == 'trial' ]]; then
father=`echo $currentBranch|sed 's#\(.*\)%.*#\1#'`
elif [[ $currentBranchType == "trial" ]]; then
father=$(echo $currentBranch|sed 's#\(.*\)%.*#\1#')
else
father=
fi
}

get_develop() {
get_currentBranchType
devCode=`echo $currentBranchTypeAll|awk -F '|' '{print $1}'`
haveDevCode=`echo $currentBranchTypeAll|grep \|`
devCode=$(echo $currentBranchTypeAll|awk -F '|' '{print $1}')
haveDevCode=$(echo $currentBranchTypeAll|grep \|)
if [[ -z "$haveDevCode" ]];then
devCode=
fi
Expand All @@ -84,8 +85,8 @@ get_develop() {

get_master() {
get_currentBranchType
devCode=`echo $currentBranchTypeAll|awk -F '|' '{print $1}'`
haveDevCode=`echo $currentBranchTypeAll|grep \|`
devCode=$(echo $currentBranchTypeAll|awk -F '|' '{print $1}')
haveDevCode=$(echo $currentBranchTypeAll|grep \|)
if [[ -z "$haveDevCode" ]];then
devCode=
fi
Expand All @@ -97,15 +98,15 @@ get_master() {
}

get_feature() {
get_develop
get_develop
if [[ -z $devCode ]]; then
feature="feature"
else
feature="$devCode|feature"
fi
}
get_issues() {
get_develop
get_develop
if [[ -z $devCode ]]; then
issues="issues"
else
Expand All @@ -119,13 +120,12 @@ get_version() {
printf "must be in the release or hotfix branches to get the version!\n"
exit 1
fi
#version=`echo $currentBranch | sed 's#.*-\(.*\)#\1#'`
version=`echo $currentBranch|awk -F '-' '{print $2}'`
devCode=`echo $currentBranch|awk -F '|' '{print $1}'`
haveDevCode=`echo $currentBranch|awk -F '|' '{print $2}'`
version=$(echo $currentBranch|awk -F '-' '{print $2}')
devCode=$(echo $currentBranch|awk -F '|' '{print $1}')
haveDevCode=$(echo $currentBranch|awk -F '|' '{print $2}')
if [[ -n "$version" ]];then
if [[ -n "$haveDevCode" ]];then
version="$devCode-$versionStr"
version="$devCode-$version"
fi
fi
}
Expand All @@ -152,17 +152,14 @@ get_currentBranchParent(){
currentBranchParent=`echo $currentBranch|sed 's#\(.*\)%.*#\1#'`
}

get_isTrialBranch(){
isTrialBranch=`echo $currentBranch|grep %`
}

get_isParentAlive(){
isParentAlive=`git rev-parse --symbolic --branches | grep -x "$currentBranchParent"`
isParentAlive=$(git rev-parse --symbolic --branches | grep -x "$currentBranchParent")
}

get_currentSHA() {
#currentSHA=`git show|grep ^commit|awk '{print $2}'`
currentSHA=`git rev-parse HEAD`
currentSHA=$(git rev-parse HEAD)
}

get_currentTagName() {
Expand All @@ -172,8 +169,8 @@ get_currentTagName() {
#paste .gg-data-temp1.txt .gg-data-temp2.txt > .gg-data-temp3.txt
#currentTagName=`cat .gg-data-temp3.txt|grep $currentSHA|head -n 1|awk '{print $1}'`
#rm .gg-data-temp*
currentTagName=`git describe --exact-match --tags`
if [[ -n `echo $currentTagName | grep "fital:"` ]]; then
currentTagName=$(git describe --exact-match --tags)
if [[ -n $(echo $currentTagName | grep "fital:") ]]; then
---currentTagName="None"
fi
}
Expand All @@ -182,16 +179,15 @@ get_currentTagVersion() {
if [[ -z $currentTagName ]]; then
get_currentTagName
fi
currentTagVersion=`echo $currentTagName|sed 's#inUse-\(.*\)#\1#'`
currentTagVersion=$(echo $currentTagName|sed 's#inUse-\(.*\)#\1#')
}

get_now() {
now=`date "+%Y-%m-%d-%H-%M-%S"`
}

testClear() {
isClear=`git status|grep -i Changes\ not\ staged``git status|grep -i Changes\ to\ be\ committed`
if [[ -n "$isClear" ]]; then
if [[ -n "$(git status --untracked-files=no --porcelain)" ]]; then
git status
printf "\n\nwe suggest you make a commit or stash before you do the next thing(Ctrl+c to abort the scripts)\nor you just want to go on doing this?(Press Enter twice for sure)"
read temp
Expand All @@ -202,7 +198,7 @@ gggttt(){
printf "\t"
}
testUntracked(){
haveUntracked=`git status|grep Untracked`
haveUntracked=$(git status --porcelain | grep "^?? ")
if [[ -n "$haveUntracked" ]]; then
git status
printf "\nyou have Untracked files!!\nThe next step will REMOVE all the files here, please make the Untracked files safe!\n\tOr you can use 'git stash' to make a stash and then 'git stash pop'\n"
Expand Down
14 changes: 1 addition & 13 deletions gg-hotfix-close
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
#!/bin/bash
#
# (__) gg
# (oo)
# /------\/ Distributed under
# / | || the GNU GPL v3 License
# * /\---/\
# ~~ ~~ http://www.gnu.org
#
#
# 2014-08-02
#
# Author: [email protected]
installPath=/usr/local/bin/gg
source $installPath/gg-functions
testClear
Expand Down Expand Up @@ -58,4 +46,4 @@ git merge --no-ff "$currentBranch" -m "Merge hotfix branch into $develop"\
&& echo "press Enter to delete branch $currentBranch"\
&& echo "press Ctrl+c to ESCAPE"\
&& read temp &&git branch -d "$currentBranch"
fi
fi
16 changes: 2 additions & 14 deletions gg-hotfix-open
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
#!/bin/bash
#
# (__) gg
# (oo)
# /------\/ Distributed under
# / | || the GNU GPL v3 License
# * /\---/\
# ~~ ~~ http://www.gnu.org
#
#
# 2014-08-02
#
# Author: [email protected]
installPath=/usr/local/bin/gg
source $installPath/gg-functions
testClear
Expand All @@ -25,7 +13,7 @@ fi
if [[ "$#" != "1" ]]; then
echo "your are in branch $currentBranch, Please input the hotfix number"
printf "Current tag names are\n"
git tag -l
git --no-pager tag
exit 1
fi

Expand All @@ -46,4 +34,4 @@ else
read temp
git checkout -b "$hotfix-$1"
git commit --allow-empty -m "Start hotfix version $1"
fi
fi
Loading

0 comments on commit af7a2a3

Please sign in to comment.