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

Take binary diffs into account for "git rebase"

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Aug 18, 2007, 22:52 UTC
Message-ID
<alpine.LFD.0.999.0708181547400.30176@woody.linux-foundation.org>
In-Reply-To
<e7bda7770708181411v67730b57ibcd8df44695e036f@mail.gmail.com>

We used to not generate a patch ID for binary diffs, but that means that some commits may be skipped as being identical to already-applied diffs when doing a rebase.

So just delete the code that skips the binary diff. At the very least, we'd want the filenames to be part of the patch ID, but we might also want to generate some hash for the binary diff itself too.

This fixes an issue noticed by Torgil Svensson.
Tested-by: Torgil Svensson <torgil.svensson@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---

Junio, you might want to do as the comment says, instead of just hashing whatever random binary patch. Your call.

On Sat, 18 Aug 2007, Torgil Svensson wrote:
> 
> This patch made the difference and solved the issue for me. Thanks
 diff.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/diff.c b/diff.c
index 97cc5bc..a7e7671 100644
--- a/diff.c
+++ b/diff.c
@@ -2919,10 +2919,6 @@ static int diff_get_patch_id(struct diff_options *options, unsigned char *sha1)
 				fill_mmfile(&mf2, p->two) < 0)
 			return error("unable to read files to diff");
 
-		/* Maybe hash p->two? into the patch id? */
-		if (diff_filespec_is_binary(p->two))
-			continue;
-
 		len1 = remove_space(p->one->path, strlen(p->one->path));
 		len2 = remove_space(p->two->path, strlen(p->two->path));
 		if (p->one->mode == 0)
Previous: Torgil Svensson
Message 6 of 6 in “file disappears after git rebase (missing one commit)”
  1. Torgil SvenssonAug 18, 2007
  2. Linus TorvaldsAug 18, 2007
  3. Torgil SvenssonAug 18, 2007
  4. Linus TorvaldsAug 18, 2007
  5. Torgil SvenssonAug 18, 2007
  6. Take binary diffs into account for "git rebase"Linus Torvalds, Aug 18, 2007

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.