Git development
 help / color / mirror / Atom feed
From: Nicolas Pitre <nico@cam.org>
To: "Randal L. Schwartz" <merlyn@stonehenge.com>
Cc: Jakub Narebski <jnareb@gmail.com>, git@vger.kernel.org
Subject: Re: How should I handle binary file with GIT
Date: Wed, 05 Apr 2006 12:21:49 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0604051155090.2550@localhost.localdomain> (raw)
In-Reply-To: <86wte4rq3d.fsf@blue.stonehenge.com>

On Wed, 5 Apr 2006, Randal L. Schwartz wrote:

> >>>>> "Nicolas" == Nicolas Pitre <nico@cam.org> writes:
> 
> >> IIRC bsdiff is used by Firefox to distribute binary software updates.
> >> Xdelta is generic (not optimized for binaries like bsdiff and edelta), but
> >> supposedly offers worse compression (bigger diffs).
> 
> Nicolas> We already have our own delta code for pack storage.
> 
> I think the issue is related to being able to cherry-pick and merge
> when binaries are involved.  I've been worried about that myself.
> How well are binaries supported these days for all the operations
> we're taking for granted?  When is a "diff" expected to be a real
> "diff" and not just "binary files differ"?

First of all, does cherry-picking binary patches is a sensible thing to 
do?

Do you expect, say, a Word document, a JPEG image, or an MP3 file to 
still be valid and error free if two binary patches modifying a 
different part of the same file (same revision) are successively 
applied?  I seriously doubt it.

And what do you do with conflicts?  Using diff3 might be sensible for 
text data, but for binaries you really need a tool that understands the 
type of data your binary contains, which means one tool for each 
possible type of binary data which is outside the scope of GIT.

For example, if you patch a .wav file adding some data, then you end up 
with the additional samples and a new length in the file header.  If 
another patch to that .wav is applied, then it is easy to find the 
"surrounding context" where the second patch is adding/removing some 
other samples, but then you really needs knowledge about the .wav format 
to handle the conflict that will occur on the .wav header modification.

And so on for all possible binary types.

So IMHO a binary patch format is only useful for easy _transport_ along 
with other text patches.  And the binary patch must either apply 
perfectly against the same source file or it must not apply at all.  
That's the only sensible accommodation we can do with a generic binary 
patch format.

When the patch doesn't apply to your tree, then nothing prevents you 
from hooking a dedicated tool that will pick up the original file, the 
reconstructed remote version according to the binary patch you received 
and your own modified version so that tool can process them and do the 
necessary changes with proper knowledge of the data format.


Nicolas

  parent reply	other threads:[~2006-04-05 16:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-05  7:30 How should I handle binary file with GIT moreau francis
2006-04-05  8:14 ` Junio C Hamano
2006-04-05 12:21   ` moreau francis
2006-04-05 13:25     ` Nicolas Pitre
2006-04-05 13:35       ` moreau francis
2006-04-05 13:06   ` Nicolas Pitre
2006-04-05 13:18   ` moreau francis
2006-04-05 19:23     ` Marco Roeland
2006-04-05 15:11   ` Jakub Narebski
2006-04-05 15:32     ` Nicolas Pitre
2006-04-05 15:37       ` Randal L. Schwartz
2006-04-05 15:55         ` Shawn Pearce
2006-04-05 16:25           ` Nicolas Pitre
2006-04-05 16:21         ` Nicolas Pitre [this message]
2006-04-05 18:34         ` Junio C Hamano
2006-04-05 18:51           ` Randal L. Schwartz
2006-04-05 19:31           ` Nicolas Pitre
2006-04-05 20:20             ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0604051155090.2550@localhost.localdomain \
    --to=nico@cam.org \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    --cc=merlyn@stonehenge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox