git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Langhoff <martin@catalyst.net.nz>
To: git@vger.kernel.org
Cc: jmacd@cs.berkeley.edu
Subject: [offtopic?] xdelta patch format wrapper
Date: Wed, 13 Feb 2008 14:53:14 +1300	[thread overview]
Message-ID: <47B24D8A.5090703@catalyst.net.nz> (raw)

This is somewhat offtopic but this list is the best-informed crowd on
diff/xdelta matters so here I am, abusing your attention...

I am working on an "incremental content" feature for Moodle - and my
plan is to serve pre-computed "patchfiles" based on the xdelta utility
to the client systems.

Now, I need to provide a wrapper that concats the deltas from the xdelta
utility with a more verbose header - akin to the header in git's unified
diff output. This is because the xdelta utility only handles one file
delta at a time - the file is a pure delta (prefaced with a SHA1 of the
file it applies to, IIRC).

(From xdelta I like that it's one-way-only, and compressed internally --
thus saving a lot of space on large changes. There are small statically
linked binaries for windows, osx and linux. I did consider using git's
own diffs, but it involves significantly more work, and portability to
Win32 is still green for the wide distribution this project is expecting.)

So my question is what is a good format for the header? My thinking sofar:

 - have a prefix to scan for, such as "xdelta" at the beginning of
   the file, or after a newline/whitespace

 - keep the <fromsha1> <tosha1> line

 - \0 delimited filenames

 - filenames as ambiguous bag'o'bytes or utf-8?
   (should we have another flamewar on this? ;-) )

 - keep file modes and perhaps support copy/move headers

 - keep a/ b/ prefixes?

 - last line in the header is length: <length-in-bytes>, followed by
   a newline and the xdelta itself

 - one or more newlines follow the end of the xdelta if there is another
   header coming

Something along the lines of

xdelta d065883..74cd8e5 100644
a/foo.zip\0
b/foo.zip\0
length 1024
<1024 bytes of xdelta data>

xdelta d065883..74cd8e5 100644
a/bar.zip\0
b/bar.zip\0
length 92312

<92312 bytes xdelta data>EOF

  ---

Would the above work as a reasonably solid patch header format? Is there
something else I should be using instead of rolling my own? If there
isn't a more suitable tool,  and I'm hoping to come up with something
unambiguous and reliable that is generally useful.

[ I have to confess, it came as a bit of a surprise that xdelta didn't
support this out of the box. Haven't seen any existing wrapper for it
that covers this either. ]

As a kludge I could tar both sides and xdelta across the tars, but it is
wasteful, and an xdelta-based diff/patch that can handle multiple files
does seem useful. And I don't know how stable the output of tar is (wrt
file ordering for example).

TIA for any feedback :-)


m
-- 

             reply	other threads:[~2008-02-13  3:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-13  1:53 Martin Langhoff [this message]
2008-02-13  3:32 ` [offtopic?] xdelta patch format wrapper Junio C Hamano
2008-02-13  3:46   ` Martin Langhoff
2008-02-13  3:56     ` Junio C Hamano
2008-02-13 11:33     ` Johannes Schindelin
2008-02-13 17:53       ` Martin Langhoff
2008-02-13  4:13   ` Martin Langhoff

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=47B24D8A.5090703@catalyst.net.nz \
    --to=martin@catalyst.net.nz \
    --cc=git@vger.kernel.org \
    --cc=jmacd@cs.berkeley.edu \
    /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;
as well as URLs for NNTP newsgroup(s).