Re: [PATCH v4 2/2] interpret-trailers: add option for in-place editing
- From
Tobias Klauser <tklauser@distanz.ch>
- Date
- Jan 15, 2016, 17:45 UTC
- Message-ID
- <20160115174522.GD21205@distanz.ch>
- In-Reply-To
- <xmqqa8o6kb6m.fsf@gitster.mtv.corp.google.com>
On 2016-01-15 at 18:24:49 +0100, Junio C Hamano <gitster@pobox.com> wrote:
Show 27 quoted lines
> Tobias Klauser <tklauser@distanz.ch> writes: > > >> > +test_expect_success POSIXPERM,SANITY "in-place editing doesn't clobber original file on error" ' > >> > + cat basic_message >message && > >> > + chmod -r message && > >> > + test_must_fail git interpret-trailers --trailer "Reviewed-by: Alice" --in-place message && > >> > + chmod +r message && > >> > + test_cmp message basic_message > >> > +' > >> > >> If for some reason interpret-trailers fails to fail, this would > >> leave an unreadable 'message' in the trash directory. Maybe no > >> other tests that come after this one want to be able to read the > >> contents of the file right now, but this is an accident waiting to > >> happen: > >> > >> cat basic_message >message && > >> + test_when_finished "chmod +r message" && > >> chmod -r message && > >> test_must_fail ... && > >> chmod +r message && > >> test_cmp ... > > > > Indeed, I forgot about this. I saw you already folded in the missing > > 'chmod +r message' in your tree. Thanks for that! > > I did no such thing, though.
Sorry, my misunderstanding. I thought about "chmod +r" but of course the essential part is the
+ test_when_finished "chmod +r message" &&
which isn't in your tree.