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

Re: [PATCH v7 03/10] pkt-line: add packet_write_fmt_gently()

From
Lars Schneider <larsxschneider@gmail.com>
Date
Sep 11, 2016, 11:36 UTC
Message-ID
<714C1346-6A7D-4A8B-AAA2-BA936EB6B739@gmail.com>
In-Reply-To
<CAGZ79kY0GaWuuh_MzKL6FZ7KWF2Kwhfh9qnEYd-qX8VDQWNmCQ@mail.gmail.com>
Show 19 quoted lines
> On 08 Sep 2016, at 23:18, Stefan Beller <sbeller@google.com> wrote:
> 
> On Thu, Sep 8, 2016 at 11:21 AM,  <larsxschneider@gmail.com> wrote:
> 
>> +static int packet_write_fmt_1(int fd, int gently,
>> +                              const char *fmt, va_list args)
>> +{
>> +       struct strbuf buf = STRBUF_INIT;
>> +       size_t count;
>> +
>> +       format_packet(&buf, fmt, args);
>> +       count = write_in_full(fd, buf.buf, buf.len);
>> +       if (count == buf.len)
>> +               return 0;
>> +
>> +       if (!gently) {
> 
>    call check_pipe from write_or_die here instead of
>    reproducing that function?

Yes, might be better. I wasn't sure because the check_pipe is not public.

Where would you declare check_pipe? In cache.h? Maybe it would be more suitable to move check_pipe to run-command.h/c?

Show 19 quoted lines
>> +               if (errno == EPIPE) {
>> +                       if (in_async())
>> +                               async_exit(141);
>> +
>> +                       signal(SIGPIPE, SIG_DFL);
>> +                       raise(SIGPIPE);
>> +                       /* Should never happen, but just in case... */
>> +                       exit(141);
>> +               }
>> +               die_errno("packet write error");
>> +       }
>> +       error("packet write failed");
>> +       return -1;
> 
> I think the more idiomatic way is to
> 
>    return error(...);
> 
> as error always return -1.
Of course!!

Thank you, Lars

Previous: Stefan BellerNext: Stefan Beller
Message 6 of 45 in “Git filter protocol”
  1. 00/10 Git filter protocollarsxschneider@gmail.com, Sep 8, 2016
  2. 01/10 pkt-line: rename packet_write() to packet_write_fmt()larsxschneider@gmail.com, Sep 8, 2016
  3. 02/10 pkt-line: extract set_packet_header()larsxschneider@gmail.com, Sep 8, 2016
  4. 03/10 pkt-line: add packet_write_fmt_gently()larsxschneider@gmail.com, Sep 8, 2016
  5. Stefan BellerSep 8, 2016
  6. Lars SchneiderSep 11, 2016
  7. Stefan BellerSep 11, 2016
  8. Lars SchneiderSep 12, 2016
  9. 04/10 pkt-line: add packet_flush_gently()larsxschneider@gmail.com, Sep 8, 2016
  10. Junio C HamanoSep 12, 2016
  11. Lars SchneiderSep 13, 2016
  12. Junio C HamanoSep 13, 2016
  13. Lars SchneiderSep 15, 2016
  14. Jeff KingSep 15, 2016
  15. Lars SchneiderSep 15, 2016
  16. Junio C HamanoSep 15, 2016
  17. 05/10 pkt-line: add packet_write_gently()larsxschneider@gmail.com, Sep 8, 2016
  18. Stefan BellerSep 8, 2016
  19. Lars SchneiderSep 11, 2016
  20. Junio C HamanoSep 12, 2016
  21. 06/10 pkt-line: add functions to read/write flush terminated packet streamslarsxschneider@gmail.com, Sep 8, 2016
  22. Stefan BellerSep 8, 2016
  23. Lars SchneiderSep 11, 2016
  24. Stefan BellerSep 11, 2016
  25. Junio C HamanoSep 11, 2016
  26. 09/10 convert: make apply_filter() adhere to standard Git error handlinglarsxschneider@gmail.com, Sep 8, 2016
  27. 08/10 convert: modernize testslarsxschneider@gmail.com, Sep 8, 2016
  28. Stefan BellerSep 8, 2016
  29. Lars SchneiderSep 11, 2016
  30. 07/10 convert: quote filter names in error messageslarsxschneider@gmail.com, Sep 8, 2016
  31. 10/10 convert: add filter.<driver>.process optionlarsxschneider@gmail.com, Sep 8, 2016
  32. Torsten BögershausenSep 10, 2016
  33. Lars SchneiderSep 12, 2016
  34. Torsten BögershausenSep 13, 2016
  35. Junio C HamanoSep 13, 2016
  36. Lars SchneiderSep 15, 2016
  37. Junio C HamanoSep 15, 2016
  38. Torsten BögershausenSep 29, 2016
  39. Jakub NarębskiSep 29, 2016
  40. Torsten BögershausenSep 10, 2016
  41. Lars SchneiderSep 13, 2016
  42. Junio C HamanoSep 13, 2016
  43. Lars SchneiderSep 15, 2016
  44. Junio C HamanoSep 15, 2016
  45. Junio C HamanoSep 13, 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.