Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix track wip

  • Loading branch information...
commit 05c2f02a3683a278f09ed284a2ef53457968d6ee 1 parent 742e4be
@orefalo authored
Showing with 13 additions and 3 deletions.
  1. +12 −2 cmds/g2-track.sh
  2. +1 −1  homebrew/g2.rb
View
14 cmds/g2-track.sh
@@ -6,8 +6,18 @@
source "$G2_HOME/cmds/color.sh"
if [[ $# -eq 1 ]]; then
- [[ $1 != */* ]] && error "${boldon}$1${boldoff} is not an upstream branch (ie. origin/xxx)."
- "$GIT_EXE" branch --set-upstream-to $1
+ [[ "$1" != */* ]] && error "${boldon}$1${boldoff} is not an upstream branch (ie. origin/xxx)."
+
+ "$GIT_EXE" ls-remote --exit-code . "$1" &> /dev/null
+ if [ $? -ne 0 ]; then
+
+ read -p "Remote branch not found, would you like to refresh from the server (y/n)? " -n 1 -r;
+ echo
+ [[ $REPLY == [yY]* ]] && "$GIT_EXE" fetch && echo "Good, now try the command again";
+ exit $?;
+ fi
+
+ "$GIT_EXE" branch --set-upstream-to "$1"
else
echo -e -n "${greenf}"
"$GIT_EXE" for-each-ref --format="local: %(refname:short) <--sync--> remote: %(upstream:short)" refs/heads
View
2  homebrew/g2.rb
@@ -4,7 +4,7 @@ class G2 < Formula
depends_on 'git' => :recommended
homepage 'http://orefalo.github.io/g2/'
- url 'https://github.com/orefalo/g2/archive/v1.0.zip'
+ url 'https://github.com/orefalo/g2/archive/v1.1.zip'
sha1 '36e03dca8d44afc1f9b16418ab0deaf093ab45c1'
head 'https://github.com/orefalo/g2.git'
Please sign in to comment.
Something went wrong with that request. Please try again.