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

Re: [PATCH v4 2/2] interpret-trailers: add option for in-place editing

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jan 18, 2016, 21:11 UTC
Message-ID
<CAPig+cRRdca7PfkqppY2X7KSFpHX0yH19fxRL+w_=u9vg7NV9A@mail.gmail.com>
In-Reply-To
<xmqqio2vki0i.fsf@gitster.mtv.corp.google.com>
On Thu, Jan 14, 2016 at 3:45 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Tobias Klauser <tklauser@distanz.ch> writes:
>> diff --git a/t/t7513-interpret-trailers.sh b/t/t7513-interpret-trailers.sh
>> @@ -326,6 +326,46 @@ test_expect_success 'with complex patch, args and --trim-empty' '
>> +test_expect_success POSIXPERM,SANITY "in-place editing doesn't clobber original file on error" '

I think POSIXPERM is all you need for this case; SANITY doesn't buy you anything, if I understand correctly.

Show 18 quoted lines
>> +     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 &&

Don't forget to remove this (now unnecessary) "chmod +r" once you've added the 'test_when_finished "chmod +r"'.

>         test_cmp ...
Previous: Tobias KlauserNext: Junio C Hamano
Message 8 of 17 in “Add in-place editing support to git interpret-trailers”
  1. 0/2 Add in-place editing support to git interpret-trailersTobias Klauser, Jan 14, 2016
  2. 1/2 trailer: allow to write to files other than stdoutTobias Klauser, Jan 14, 2016
  3. 2/2 interpret-trailers: add option for in-place editingTobias Klauser, Jan 14, 2016
  4. Junio C HamanoJan 14, 2016
  5. Tobias KlauserJan 15, 2016
  6. Junio C HamanoJan 15, 2016
  7. Tobias KlauserJan 15, 2016
  8. Eric SunshineJan 18, 2016
  9. Junio C HamanoJan 19, 2016
  10. Eric SunshineJan 19, 2016
  11. Eric SunshineJan 19, 2016
  12. Junio C HamanoJan 19, 2016
  13. Eric SunshineJan 19, 2016
  14. Junio C HamanoJan 19, 2016
  15. Eric SunshineJan 20, 2016
  16. Eric SunshineJan 18, 2016
  17. Tobias KlauserJan 19, 2016

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.