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

[PATCH 4/4] rebase: make it usable for binary files as well.

From
Junio C Hamano <junkio@cox.net>
Date
Nov 15, 2005, 23:34 UTC
Message-ID
<7v64qtfptx.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7voe4lfpxm.fsf@assigned-by-dhcp.cox.net>

Use git-format-patch --full-index to generate a patch, and feed that to git-am that uses git-apply --allow-binary-replacement. This way, rebase can be used to move development that contains binary files as long as there is no need for file-level merges.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 git-am.sh     |    7 ++++---
 git-rebase.sh |    2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

applies-to: 349326f3647597dabf38d82e1c2806cef45060f7 7f5bff7c3e5b1245e479fc13665641424dee9a41

diff --git a/git-am.sh b/git-am.sh
index 38841d9..8307d77 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -46,7 +46,7 @@ fall_back_3way () {
 	    cd "$dotest/patch-merge-tmp-dir" &&
 	    GIT_INDEX_FILE="../patch-merge-tmp-index" \
 	    GIT_OBJECT_DIRECTORY="$O_OBJECT" \
-	    git-apply --index <../patch
+	    git-apply --allow-binary-replacement --index <../patch
         )
     then
 	echo Using index info to reconstruct a base tree...
@@ -77,7 +77,7 @@ fall_back_3way () {
 		GIT_OBJECT_DIRECTORY="$O_OBJECT" &&
 		export GIT_INDEX_FILE GIT_OBJECT_DIRECTORY &&
 		git-read-tree "$base" &&
-		git-apply --index &&
+		git-apply --index --allow-binary-replacement &&
 		mv ../patch-merge-tmp-index ../patch-merge-index &&
 		echo "$base" >../patch-merge-base
 	    ) <"$dotest/patch"  2>/dev/null && break
@@ -310,7 +310,8 @@ do
 	echo "Applying '$SUBJECT'"
 	echo
 
-	git-apply --index "$dotest/patch"; apply_status=$?
+	git-apply --allow-binary-replacement --index "$dotest/patch"
+	apply_status=$?
 	if test $apply_status = 1 && test "$threeway" = t
 	then
 		if (fall_back_3way)
diff --git a/git-rebase.sh b/git-rebase.sh
index 56196e7..b8abf33 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -25,4 +25,4 @@ esac
 
 # Rewind the head to "$other"
 git-reset --hard "$other"
-git-format-patch -k --stdout "$other" ORIG_HEAD | git am -3 -k
+git-format-patch -k --stdout --full-index "$other" ORIG_HEAD | git am -3 -k
---
0.99.9.GIT
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 8 in “reworking git-rebase”
  1. 0/4 reworking git-rebaseJunio C Hamano, Nov 15, 2005
  2. 1/4 Rewrite rebase to use git-format-patch piped to git-am.Junio C Hamano, Nov 15, 2005
  3. 2/4 apply: allow-binary-replacement.Junio C Hamano, Nov 15, 2005
  4. 3/4 diff: --full-indexJunio C Hamano, Nov 15, 2005
  5. 4/4 rebase: make it usable for binary files as well.Junio C Hamano, Nov 15, 2005
  6. git-am: --resolved.Junio C Hamano, Nov 16, 2005
  7. Sven VerdoolaegeNov 17, 2005
  8. Junio C HamanoNov 17, 2005

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.