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

[PATCH v2 RFC] rebase-i-p: do not include non-first-parent commits touching UPSTREAM

From
Stephen Haberman <stephen@exigencecorp.com>
Date
Oct 8, 2008, 06:41 UTC
Message-ID
<c3ab1457d971985e349a0747178132c0c6f68b8a.1223445353.git.stephen@exigencecorp.com>
In-Reply-To
<90b5228cee1617efcb970f4e27b26c769f78a9bd.1223445353.git.stephen@exigencecorp.com>

This covers an odd boundary case found by Avi Kivity's script where a branch coming off of UPSTREAM is merged into HEAD. Initially it show up in UPSTREAM..HEAD, but technically UPSTREAM is not moving, the rest of head is, so we should not need to rewrite the merge.

This adds a check saying we can keep `preserve=t` if `p=UPSTREAM`...unless this is the first first-parent commit in our UPSTREAM..HEAD rev-list, which could very well point to UPSTREAM, but we still need to consider it as rewritten so we start pulling in the rest of the UPSTREAM..HEAD commits that point to it.

Signed-off-by: Stephen Haberman <stephen@exigencecorp.com>
---
 git-rebase--interactive.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 7003ac0..2e9270a 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -553,6 +553,7 @@ first and then run 'git rebase --continue' again."
 					die "Could not init rewritten commits"
 			done
 			MERGES_OPTION=
+			first_after_upstream="$(git rev-list --reverse --first-parent $UPSTREAM..$HEAD | head -n 1)"
 		else
 			MERGES_OPTION=--no-merges
 		fi
@@ -573,7 +574,7 @@ first and then run 'git rebase --continue' again."
 				preserve=t
 				for p in $(git rev-list --parents -1 $sha1 | cut -d' ' -f2-)
 				do
-					if test -f "$REWRITTEN"/$p
+					if test -f "$REWRITTEN"/$p -a \( $p != $UPSTREAM -o $sha1 = $first_after_upstream \)
 					then
 						preserve=f
 					fi
-- 
1.6.0.2
Previous: Stephen HabermanNext: Stephen Haberman
Message 7 of 11 in “rebase-i-p: squashing and limiting todo”
  1. rebase-i-p: squashing and limiting todoStephen Haberman, Oct 8, 2008
  2. rebase-i-p: test to exclude commits from todo based on its parentsStephen Haberman, Oct 8, 2008
  3. rebase-i-p: use HEAD for updating the ref instead of mapping OLDHEADStephen Haberman, Oct 8, 2008
  4. rebase-i-p: delay saving current-commit to REWRITTEN if squashingStephen Haberman, Oct 8, 2008
  5. rebase-i-p: fix 'no squashing merges' tripping up non-mergesStephen Haberman, Oct 8, 2008
  6. rebase-i-p: only list commits that require rewriting in todoStephen Haberman, Oct 8, 2008
  7. rebase-i-p: do not include non-first-parent commits touching UPSTREAMStephen Haberman, Oct 8, 2008
  8. rebase-i-p: if todo was reordered use HEAD as the rewritten parentStephen Haberman, Oct 8, 2008
  9. Junio C HamanoOct 8, 2008
  10. Stephen HabermanOct 9, 2008
  11. Stephen HabermanOct 8, 2008

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.