Permalink
Browse files

fix compatibility issue on linux

  • Loading branch information...
1 parent 92a8d95 commit 57d935fb1ab0041c742626670441914d088cccea @orefalo committed Apr 26, 2013
Showing with 15 additions and 17 deletions.
  1. +5 −7 cmds/color.sh
  2. +1 −1 cmds/g2-br.sh
  3. +1 −1 cmds/g2-ci.sh
  4. +1 −1 cmds/g2-co.sh
  5. +1 −1 cmds/g2-cp.sh
  6. +1 −1 cmds/g2-g2am.sh
  7. +1 −1 cmds/g2-g2pull.sh
  8. +1 −1 cmds/g2-g2push.sh
  9. +1 −1 cmds/g2-mg.sh
  10. +2 −2 cmds/g2-sync.sh
View
@@ -3,16 +3,14 @@ g2_initializeANSI()
g2esc="\033"
blackf="${g2esc}[30m"; redf="${g2esc}[31m"; greenf="${g2esc}[32m";
- yellowf="${g2esc}[33m" bluef="${g2esc}[34m"; purplef="${g2esc}[35m";
+ yellowf="${g2esc}[33m"; bluef="${g2esc}[34m"; purplef="${g2esc}[35m";
cyanf="${g2esc}[36m"; whitef="${g2esc}[37m";
-
boldon="${g2esc}[1m"; boldoff="${g2esc}[22m";
-
reset="${g2esc}[0m";
}
-g2_initializeANSI
+g2_initializeANSI;
-fatal() { echo -e "${redf}fatal: $1${reset}"; }
-error() { fatal "$1"; exit 1; }
-echo_info() { echo -e "${boldon}$1${reset}"; }
+function fatal { echo -e "${redf}fatal: $1${reset}"; }
+function error { fatal "$1"; exit 1; }
+function echo_info { echo -e "${boldon}$1${reset}"; }
View
@@ -41,7 +41,7 @@ else
hasDMFlag "$@"
[[ $flag = "exit" ]] && exit 1;
[[ $flag = "true" ]] && { "$GIT_EXE" branch "$@"; exit $?; }
- $("$GIT_EXE" g2haschanges) || exit 1;
+ "$GIT_EXE" g2haschanges || exit 1;
shift $(( OPTIND - 1 ))
branch="${1:-/}"
View
@@ -3,5 +3,5 @@
#
source "$G2_HOME/cmds/color.sh"
-$("$GIT_EXE" g2iswip) || exit 1
+"$GIT_EXE" g2iswip || exit 1
[[ $("$GIT_EXE" diff --cached --numstat | wc -l) -eq 0 ]] && fatal "No files to commit, please use ${boldon}g freeze${boldoff} to stage changes." || "$GIT_EXE" commit -u "$@"
View
@@ -9,7 +9,7 @@ else
isBranch=$("$GIT_EXE" branch -a | grep -c "$1")
[[ $isBranch -gt 0 ]] && {
"$GIT_EXE" abort
- $("$GIT_EXE" g2haschanges) || exit 1
+ "$GIT_EXE" g2haschanges || exit 1
g2excludes=$("$GIT_EXE" config --global --get g2.panic.excludes)
"$GIT_EXE" checkout "$@" && "$GIT_EXE" clean -fdx $g2excludes
exit $?;
View
@@ -2,5 +2,5 @@
#
# Cherry picking, but forbids anything on top of wip commit
-$("$GIT_EXE" g2iswip) || exit 1
+"$GIT_EXE" g2iswip || exit 1
"$GIT_EXE" cherry-pick "$@"
View
@@ -4,7 +4,7 @@ source "$G2_HOME/cmds/color.sh"
[[ $("$GIT_EXE" diff --cached --numstat | wc -l) -eq 0 ]] && error "No files to amend, please use ${boldon}g freeze${boldoff} to stage the changes to amend."
-$("$GIT_EXE" g2haslocalcommit)
+"$GIT_EXE" g2haslocalcommit
if [[ $? -eq 0 ]]; then
if [[ $1 = "-f" ]]; then
read -p "Warning: force amending will rewrite the history, please confirm (y/n)? " -n 1 -r
View
@@ -15,7 +15,7 @@ usage() {
n=$#;
[[ $n -eq 0 || ${!n} = -* ]] && err
-$("$GIT_EXE" g2iswip) || exit 1
+"$GIT_EXE" g2iswip || exit 1
[[ ${!n} = */* ]] && usage
branch=${!n}
let n--
View
@@ -30,7 +30,7 @@ hasFFlag() {
fflg=$( hasFFlag "$@" )
n=$#;
[[ $fflg = "false" && $n -eq 0 ]] && err
-$("$GIT_EXE" g2iswip) || exit 1
+"$GIT_EXE" g2iswip || exit 1
[[ $fflg = "true" ]] && {
read -p "warning: you are about to force push history, please confirm (y/n)? " -n 1 -r;
echo
View
@@ -3,7 +3,7 @@
source "$G2_HOME/cmds/color.sh"
-$("$GIT_EXE" g2iswip) || exit 1
+"$GIT_EXE" g2iswip || exit 1
# substitute "upstream" with real upstream name
declare -a v=("$@")
View
@@ -11,11 +11,11 @@ source "$G2_HOME/cmds/color.sh"
remote=$("$GIT_EXE" g2getremote)
-$("$GIT_EXE" g2iswip $remote) || exit 1;
+"$GIT_EXE" g2iswip $remote || exit 1;
[[ -z $remote ]] && fatal "Please use ${boldon}g track remote/branch${boldoff} to setup tracking" && exit 2
[[ $# -ne 0 ]] && fatal "Sorry, you may only ${boldon}sync${boldoff} against the tracking remote/branch, use ${boldon}pull${boldoff} or ${boldon}push${boldoff} to deal with other branches." && exit 3
"$GIT_EXE" fetch || exit $?;
-$("$GIT_EXE" g2isforced $remote) && fatal "It appears the history of the branch was changed on the server." && error "please issue a ${boldon}g rs upstream${boldoff} or a ${boldon}g rb $remote${boldoff} to resume";
+"$GIT_EXE" g2isforced $remote && fatal "It appears the history of the branch was changed on the server." && error "please issue a ${boldon}g rs upstream${boldoff} or a ${boldon}g rb $remote${boldoff} to resume";
branch=$("$GIT_EXE" branch | grep "*" | sed "s/* //")
# count the number of changes in/out

0 comments on commit 57d935f

Please sign in to comment.