Skip to content

Commit

Permalink
fix sync saying that branch is in the past
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Refalo committed Mar 6, 2013
1 parent b696b02 commit 3080e06
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmds/g2-g2isbehind.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash
#
# Returns 1 if the branch is behind its upstream branch, 0 if not
# Returns 0 if the branch is behind its upstream branch, 1 if not

local=$("$GIT_EXE" branch | grep "*" | sed "s/* //")
remote=$1
[[ -z $1 ]] && remote=$("$GIT_EXE" g2getremote)
[[ -n $remote ]] && {
"$GIT_EXE" fetch
RIGHT_AHEAD=$("$GIT_EXE" rev-list --left-right ${local}...${remote} -- 2> /dev/null | grep -c "^>")
[[ $RIGHT_AHEAD -gt 0 ]] && exit 1;
[[ $RIGHT_AHEAD -gt 0 ]] && exit 0;
}
exit 0;
exit 1;

0 comments on commit 3080e06

Please sign in to comment.