Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support tracking configurations where local and remote branch names d…

…iffer.
  • Loading branch information...
commit b0807d3d885e73422d2b040018010d1c7a4a34ed 1 parent 42c8ca8
@eventualbuddha eventualbuddha authored
Showing with 13 additions and 12 deletions.
  1. +6 −5 bin/hack
  2. +7 −7 bin/ship
View
11 bin/hack
@@ -121,12 +121,13 @@ fi
TRACK=`$GIT config branch.$branch.merge`
if [ -z "$TRACK" ]; then
- TRACK=refs/heads/master
+ TRACK_BRANCH=master
+else
+ TRACK_BRANCH=${TRACK#refs/heads/}
fi
-TRACK_BRANCH=${TRACK#refs/heads/}
-
-if [ "$CURRENT" != "$TRACK_BRANCH" ]; then
+# if we're not explicitly tracking something, rebase against master
+if [[ -z "$TRACK" && "$CURRENT" != "$TRACK_BRANCH" ]]; then
git checkout $TRACK_BRANCH ||
die "Could not switch to $TRACK_BRANCH. Nothing has been changed yet."
fi
@@ -147,7 +148,7 @@ else
die "Could not rebase against $REMOTE/$TRACK_BRANCH. You may need to resolve conflicts."
fi
-if [ "$branch" != "$TRACK_BRANCH" ]; then
+if [[ -z "$TRACK" && "$branch" != "$TRACK_BRANCH" ]]; then
git checkout $branch ||
die "Could not switch back to $branch."
git rebase $TRACK_BRANCH ||
View
14 bin/ship
@@ -96,12 +96,12 @@ fi
TRACK=`$GIT config branch.$CURRENT.merge`
if [ -z "$TRACK" ]; then
- TRACK=refs/heads/master
+ TRACK_BRANCH=master
+else
+ TRACK_BRANCH=${TRACK#refs/heads/}
fi
-TRACK_BRANCH=${TRACK#refs/heads/}
-
-if [ "$CURRENT" != "$TRACK_BRANCH" ]; then
+if [[ -z "$TRACK" && "$CURRENT" != "$TRACK_BRANCH" ]]; then
git checkout $TRACK_BRANCH ||
die "Could not switch to $TRACK_BRANCH. Nothing has been changed yet."
fi
@@ -118,15 +118,15 @@ if [ "$TYPE" = "git-svn" ]; then
git svn dcommit ||
die "Failed to commit to the upstream Subversion server. Check your network connection."
else
- if [ "$CURRENT" != "$TRACK_BRANCH" ]; then
+ if [[ -z "$TRACK" && "$CURRENT" != "$TRACK_BRANCH" ]]; then
git merge $CURRENT ||
die "Could not merge branch $CURRENT into $TRACK_BRANCH. You may need to resolve conflicts."
fi
- git push $REMOTE $TRACK_BRANCH ||
+ git push $REMOTE $CURRENT:$TRACK_BRANCH ||
die "Could not push changes to $REMOTE/$TRACK_BRANCH. Check your network connection."
fi
-if [ "$CURRENT" != "$TRACK_BRANCH" ]; then
+if [[ -z "$TRACK" && "$CURRENT" != "$TRACK_BRANCH" ]]; then
git checkout $CURRENT ||
die "Could not switch back to $CURRENT from $TRACK_BRANCH."
fi
Please sign in to comment.
Something went wrong with that request. Please try again.