git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 25, 2009, 23:31 UTC
Message-ID
<alpine.DEB.1.00.0901260031460.14855@racer>
In-Reply-To
<alpine.DEB.1.00.0901260029480.14855@racer>

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@gmx.de>
---
 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
Previous: Johannes SchindelinNext: Thomas Rast
Message 2 of 22 in “rebase -i --root cleanups”
  1. 0/2 rebase -i --root cleanupsJohannes Schindelin, Jan 25, 2009
  2. 1/2 rebase -i --root: simplify codeJohannes Schindelin, Jan 25, 2009
  3. Thomas RastJan 25, 2009
  4. Thomas RastJan 25, 2009
  5. Junio C HamanoJan 26, 2009
  6. rebase -i: correctly remember --root flag across --continueThomas Rast, Jan 26, 2009
  7. Junio C HamanoJan 26, 2009
  8. Junio C HamanoJan 26, 2009
  9. Jeff KingJan 26, 2009
  10. Jeff KingJan 26, 2009
  11. Thomas RastJan 26, 2009
  12. Junio C HamanoJan 27, 2009
  13. Junio C HamanoJan 26, 2009
  14. Thomas RastJan 30, 2009
  15. 1/2 t3412: clean up GIT_EDITOR usageThomas Rast, Jan 30, 2009
  16. 2/2 t3412: use log|name-rev instead of log --graphThomas Rast, Jan 30, 2009
  17. Johannes SchindelinFeb 1, 2009
  18. Thomas RastFeb 2, 2009
  19. Johannes SchindelinJan 26, 2009
  20. 2/2 rebase -i --root: fix check for number of argumentsJohannes Schindelin, Jan 25, 2009
  21. Thomas RastJan 26, 2009
  22. Johannes SchindelinJan 26, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.