git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jason Xu <jasonx98@gmail.com>
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>, git@vger.kernel.org
Subject: Re: Force git diff to create a binary patch?
Date: Mon, 13 Jul 2020 21:34:06 -0700	[thread overview]
Message-ID: <xmqq5zaqn29t.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <CAGPh-qPyTNidqT=K-U8iYtG3udFZVFBhE1RyA1AZ1qEqN_NnZw@mail.gmail.com> (Jason Xu's message of "Tue, 14 Jul 2020 00:09:41 -0400")

Jason Xu <jasonx98@gmail.com> writes:

>> The description for the --binary option reads as follows:
>>
>>   In addition to --full-index, output a binary diff that can be applied
>>   with git-apply. Implies --patch.
>>
>> So we need to fix either the documentation or the code.
>>
>> I looked into what it takes to fix the code to do this; it's fairly
>> straightforward, but it does cause some testsuite failures which assume
>> the current behavior and will likely involve a small series.  So if
>> other folks agree, I'm happy to pick this up in the next couple of weeks
>> and add support for it that would hopefully hit Git 2.29.

I am not convinced.  

The "--binary" option was invented as a way to tell Git to produce
something that can be applied, where Git stopped at saying "binary
files differ".  So a commit that touches two paths, one text and the
other binary, used to produce a textual patch for one and a useless
"binary files differ" for the other in "git show".  Such a commit
can be made more useful with "git show --binary" to tell the former
to still produce textual and readable patch while showing the xdelta
based "binary patch" Git invented.

So, no, I am less convinced "--binary" that forces "all paths are
binary, so show binary patch" is a good idea.

And viewed with the knowledge of that history,

>>   In addition to --full-index, output a binary diff that can be applied
>>   with git-apply. Implies --patch.

this description is correct---the choice is not between "showing a
binary diff and showing a useless textual diff"; the choice is
between showing "binary files differ" and appliable "binary patch".


  reply	other threads:[~2020-07-14  4:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-13  4:58 Force git diff to create a binary patch? Jason Xu
2020-07-13 14:51 ` Junio C Hamano
     [not found] ` <20200713223906.GH8360@camp.crustytoothpaste.net>
2020-07-14  4:09   ` Jason Xu
2020-07-14  4:34     ` Junio C Hamano [this message]
2020-07-14  4:34     ` Junio C Hamano
2020-07-14  4:56       ` Jason Xu
2020-07-14 15:35         ` 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=xmqq5zaqn29t.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jasonx98@gmail.com \
    --cc=sandals@crustytoothpaste.net \
    /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).