diff options
author | Junio C Hamano <junkio@cox.net> | 2006-05-04 16:51:44 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-05-05 15:24:32 -0700 |
commit | 051308f6e9cebeb76b8fb4f52b7e9e7ce064445c (patch) | |
tree | 4449e79bcbe2ea2fb18b61f71280e29cc15823c9 /config.c | |
parent | pack-object: squelch eye-candy on non-tty (diff) | |
download | tgif-051308f6e9cebeb76b8fb4f52b7e9e7ce064445c.tar.xz |
binary patch.
This adds "binary patch" to the diff output and teaches apply
what to do with them.
On the diff generation side, traditionally, we said "Binary
files differ\n" without giving anything other than the preimage
and postimage object name on the index line. This was good
enough for applying a patch generated from your own repository
(very useful while rebasing), because the postimage would be
available in such a case. However, this was not useful when the
recipient of such a patch via e-mail were to apply it, even if
the preimage was available.
This patch allows the diff to generate "binary" patch when
operating under --full-index option. The binary patch follows
the usual extended git diff headers, and looks like this:
"GIT binary patch\n"
<length byte><data>"\n"
...
"\n"
Each line is prefixed with a "length-byte", whose value is upper
or lowercase alphabet that encodes number of bytes that the data
on the line decodes to (1..52 -- 'A' means 1, 'B' means 2, ...,
'Z' means 26, 'a' means 27, ...). <data> is 1 or more groups of
5-byte sequence, each of which encodes up to 4 bytes in base85
encoding. Because 52 / 4 * 5 = 65 and we have the length byte,
an output line is capped to 66 characters. The payload is the
same diff-delta as we use in the packfiles.
On the consumption side, git-apply now can decode and apply the
binary patch when --allow-binary-replacement is given, the diff
was generated with --full-index, and the receiving repository
has the preimage blob, which is the same condition as it always
required when accepting an "Binary files differ\n" patch.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'config.c')
0 files changed, 0 insertions, 0 deletions