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

Re: rejecting patches that have an offset

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 16, 2011, 23:22 UTC
Message-ID
<7vobzpeybh.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4E49A8EA.5020507@redhat.com>
Eric Blake <eblake@redhat.com> writes:
> It would have saved me a lot of time if both 'patch' and 'git apply'
> could be taught a mode of operation where they explicitly reject a
> patch that cannot be applied without relying on an offset.

I am not sure about this. I somehow doubt you would want to make sure that the preimage your patch is to be applied must be bit-for-bit identical to what you prepared your patch for, IOW, you are using a patchfile merely as a mean to "compress" the replacement file. You would want your RPM change to tolerate some changes in the upstream and keep your patch applicable to the next version of the upstream, no?

Given a patch that is not precise and can apply to multiple places, "patch" and/or "git apply" can apply it to a place you may not have intended. It may feel like a bug if that happens to a preimage that is bit-for-bit identical to the version you prepared your patch is against, but I would rather think, instead of blaming "patch" and/or "git apply", it would be more productive to prepare a patch with larger context when you know that the preimage file you are patching has many similar looking lines, to make it _impossible_ for it to apply to places different from what you intended.

Previous: Eric BlakeNext: Andreas Gruenbacher
Message 2 of 5 in “rejecting patches that have an offset”
  1. Eric BlakeAug 15, 2011
  2. Junio C HamanoAug 16, 2011
  3. Andreas GruenbacherAug 16, 2011
  4. Eric BlakeAug 16, 2011
  5. Eric BlakeAug 16, 2011

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.