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