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

Re: [RFC PATCH] builtin-apply: prevent non-explicit permission changes

From
Jeff King <peff@peff.net>
Date
Jan 2, 2009, 17:35 UTC
Message-ID
<20090102173513.GA8109@coredump.intra.peff.net>
In-Reply-To
<7vwsdec6za.fsf@gitster.siamese.dyndns.org>
On Fri, Jan 02, 2009 at 02:55:37AM -0800, Junio C Hamano wrote:
Show 5 quoted lines
> A git patch that does not change the executable bit still records the mode
> on its "index" line.  "git apply" used to interpret this mode exactly the
> same way as it interprets the mode recorded on "new mode" line.  As the
> wish by the patch submitter to set the mode to the one recorded on the
> line.
Nit: I had to read that third sentence several times to make sense of
it, since it is not a complete sentence (I think s/line\. As/line: as/
might help).
Show 5 quoted lines
> This changes the semantics of the mode recorded on the "index" line;
> instead of interpreting it as the submitter's wish to set the mode to the
> recorded value, it merely informs what the mode submitter happened to
> have, and the presense of the "index" line is taken as submitter's wish to
> keep whatever the mode is on the receiving end.

I have been following this thread but didn't have a chance to look closely until now. I think this change is definitely the right thing, as it follows the normal semantics for a patch (which are basically a merge: "change the parts we changed, but leave everything else, even if the other side changed it").

>  builtin-apply.c           |    4 ++-
The implementation looks good to me.
>  t/t4129-apply-samemode.sh |   62 ++++++++++++++++++++++++++++++++++++++++

And the tests make me feel warm and fuzzy. It is always nice to see tests that aren't just "X was broken, and now it works" or "new feature Y works" but "here is every case spelled out with its desired behavior." I think those are the tests that really help keep us regression-proof.

-Peff
Previous: Junio C Hamano
Message 7 of 7 in “builtin-apply: prevent non-explicit permission changes”
  1. builtin-apply: prevent non-explicit permission changesAlexander Potashev, Dec 30, 2008
  2. Junio C HamanoJan 1, 2009
  3. Alexander PotashevJan 1, 2009
  4. Junio C HamanoJan 2, 2009
  5. Alexander PotashevJan 2, 2009
  6. Junio C HamanoJan 2, 2009
  7. Jeff KingJan 2, 2009

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.