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

[RFC/PATCH] rebase: Allow to turn of ignore-if-in-upstream

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Jul 13, 2010, 08:13 UTC
Message-ID
<645d8a9bf671937c1a6962b49cf1c512e0af0d82.1279008702.git.git@drmicha.warpmail.net>
In-Reply-To
<4C3C1FE9.40605@drmicha.warpmail.net>

git-rebase uses "format-patch --ignore-if-in-upstream" do determine which commits to apply. This may or may not be desired: a user may want to transplant all commits, or may opt to avoid the possibly time consuming calculation of patch-ids.

Therefore, introduce rebase.cherry (defaulting to true) and --cherry and --no-cherry options (to override the config), where --cherry means the current behavior and --no-cherry avoids "--ignore-if-in-upstream".

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
RFC for obvious reasons (doc, tests).
 git-rebase.sh |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index ab4afa7..1eb6ad1 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -53,6 +53,7 @@ git_am_opt=
 rebase_root=
 force_rebase=
 allow_rerere_autoupdate=
+cherry=$(git config --bool rebase.cherry)
 
 continue_merge () {
 	test -n "$prev_head" || die "prev_head must be defined"
@@ -307,6 +308,12 @@ do
 		esac
 		do_merge=t
 		;;
+	--cherry)
+		cherry=true
+		;;
+	--no-cherry)
+		cherry=false
+		;;
 	-n|--no-stat)
 		diffstat=
 		;;
@@ -540,9 +547,16 @@ else
 	revisions="$upstream..$orig_head"
 fi
 
+if test "x$cherry" = "xfalse"
+then
+	cherry_opt=""
+else
+	cherry_opt="--ignore-if-in-upstream"
+fi
+
 if test -z "$do_merge"
 then
-	git format-patch -k --stdout --full-index --ignore-if-in-upstream \
+	git format-patch -k --stdout --full-index $cherry_opt \
 		$root_flag "$revisions" |
 	git am $git_am_opt --rebasing --resolvemsg="$RESOLVEMSG" &&
 	move_to_original_branch
-- 
1.7.2.rc1.212.g850a
Previous: Michael J GruberNext: Erik Faye-Lund
Message 3 of 7 in “VERY slow git format-patch (tens on minutes) during rebase and rev-list during rebase -i”
  1. Marat RadchenkoJul 13, 2010
  2. Michael J GruberJul 13, 2010
  3. rebase: Allow to turn of ignore-if-in-upstreamMichael J Gruber, Jul 13, 2010
  4. Erik Faye-LundJul 13, 2010
  5. Michael J GruberSep 4, 2010
  6. Marat RadchenkoSep 9, 2010
  7. [FEATURE REQUEST] allow enabling patience diff algorithm by defaultMarat Radchenko, Oct 13, 2010

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.