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.