[PATCH 1/2] rebase -i --root: simplify code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When we rebase with --root, what we are actually picking are the commits
in $ONTO..$HEAD.  So $ONTO is really our $UPSTREAM.  Spell it out.

Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
---
 git-rebase--interactive.sh |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 21ac20c..6e2bf25 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -581,13 +581,15 @@ first and then run 'git rebase --continue' again."
 		if test -z "$REBASE_ROOT"
 		then
 			UPSTREAM_ARG="$1"
-			UPSTREAM=$(git rev-parse --verify "$1") || die "Invalid base"
+			UPSTREAM=$(git rev-parse --verify "$1") ||
+				die "Invalid base"
 			test -z "$ONTO" && ONTO=$UPSTREAM
 			shift
 		else
 			UPSTREAM_ARG=--root
 			test -z "$ONTO" &&
 				die "You must specify --onto when using --root"
+			UPSTREAM=$ONTO
 		fi
 		run_pre_rebase_hook "$UPSTREAM_ARG" "$@"
 
@@ -648,16 +650,9 @@ first and then run 'git rebase --continue' again."
 
 		SHORTHEAD=$(git rev-parse --short $HEAD)
 		SHORTONTO=$(git rev-parse --short $ONTO)
-		if test -z "$REBASE_ROOT"
-			# this is now equivalent to ! -z "$UPSTREAM"
-		then
-			SHORTUPSTREAM=$(git rev-parse --short $UPSTREAM)
-			REVISIONS=$UPSTREAM...$HEAD
-			SHORTREVISIONS=$SHORTUPSTREAM..$SHORTHEAD
-		else
-			REVISIONS=$ONTO...$HEAD
-			SHORTREVISIONS=$SHORTHEAD
-		fi
+		SHORTUPSTREAM=$(git rev-parse --short $UPSTREAM)
+		REVISIONS=$UPSTREAM...$HEAD
+		SHORTREVISIONS=$SHORTUPSTREAM..$SHORTHEAD
 		git rev-list $MERGES_OPTION --pretty=oneline --abbrev-commit \
 			--abbrev=7 --reverse --left-right --topo-order \
 			$REVISIONS | \
-- 
1.6.1.482.g7d54be


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux