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

Re: Why is there a --binary option needed for git-apply?

From
Shawn Pearce <spearce@spearce.org>
Date
Sep 6, 2006, 03:38 UTC
Message-ID
<20060906033803.GA30598@spearce.org>
In-Reply-To
<874pvmxikq.wl%cworth@cworth.org>
Carl Worth <cworth@cworth.org> wrote:
Show 8 quoted lines
> Shawn Pearce was kind enough to direct me to the --binary option for
> git-apply which solved my problem. But that left me wondering why
> git-apply requires this extra command-line option to do its
> job. Shouldn't git-apply simply apply the patch it is given?
> 
> If there is some reason for git-apply to only apply binary patches
> when under the duress of --binary, then at the very least it could use
> a better error message explaining the situation.

I see no reason why git-apply shouldn't always have --binary enabled. If the patch contains full pre-image/post-image blob IDs and we have an exact match against the pre-image and we have the post-image in our tree it should just apply even if the user didn't supply --binary. If the patch contains a binary delta and we have an exact match against the pre-image it should also just apply.

But if there's a binary hunk and we lack the full pre/post image blob IDs, we lack the post image and there's no detla, or the pre-image doesn't exactly match then we should obviously still abort with a reasonable error message as there's no sane course of action to take.

-- 
Shawn.
Previous: Carl WorthNext: Junio C Hamano
Message 2 of 3 in “Why is there a --binary option needed for git-apply?”
  1. Carl WorthSep 5, 2006
  2. Shawn PearceSep 6, 2006
  3. Junio C HamanoSep 7, 2006

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.