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

Re: [PATCHv4 3/5] run-command: add {run,start,finish}_command_or_die

From
Stefan Beller <sbeller@google.com>
Date
Dec 20, 2016, 19:23 UTC
Message-ID
<CAGZ79kYNKWfnEXWJfyRUutFyaQiRD9qW--LkK4Nbwdf7FtdPQA@mail.gmail.com>
In-Reply-To
<aad0af97-7588-632d-a113-5d8372b8b7a8@kdbg.org>
On Tue, Dec 20, 2016 at 10:33 AM, Johannes Sixt <j6t@kdbg.org> wrote:
Show 22 quoted lines
> Am 20.12.2016 um 00:28 schrieb Stefan Beller:
>>
>> +static void report_and_die(struct child_process *cmd, const char *action)
>> +{
>> +       int i;
>> +       struct strbuf err = STRBUF_INIT;
>> +       if (cmd->git_cmd)
>> +               strbuf_addstr(&err, "git ");
>> +       for (i = 0; cmd->argv[i]; )
>> +               strbuf_addf(&err, "'%s'", cmd->argv[i]);
>
>
> Take note that cmd is accessed here.
>
>> +       die(_("could not %s %s"), action, err.buf);
>
>
> Should lego sentences not be avoided? They are not exactly translator
> friendly.
>
> Given that a lot of effort is spent elsewhere to actually *avoid* dying in
> library code, this new die() is not very welcome, I must say.

I agree on the sentiment. In a reroll I'll drop this patch and instead introduce a function `char *get_child_command_line(struct child_process*);`, which a caller can call before calling finish_command and then use the resulting string to assemble an error message without lego.

Thanks for the thorough review! Stefan

Previous: Johannes SixtNext: Johannes Sixt
Message 8 of 16 in “[PATCHv4 0/5] git-rm absorbs submodule git directory before deletion”
  1. Stefan BellerDec 19, 2016
  2. 1/5 submodule.h: add extern keyword to functionsStefan Beller, Dec 19, 2016
  3. 3/5 run-command: add {run,start,finish}_command_or_dieStefan Beller, Dec 19, 2016
  4. Brandon WilliamsDec 19, 2016
  5. Stefan BellerDec 19, 2016
  6. Johannes SixtDec 20, 2016
  7. Johannes SixtDec 20, 2016
  8. Stefan BellerDec 20, 2016
  9. Johannes SixtDec 20, 2016
  10. Stefan BellerDec 20, 2016
  11. Johannes SixtDec 20, 2016
  12. Stefan BellerDec 20, 2016
  13. 5/5 rm: absorb a submodules git dir before deletionStefan Beller, Dec 19, 2016
  14. 2/5 submodule: modernize ok_to_remove_submodule to use argv_arrayStefan Beller, Dec 19, 2016
  15. 4/5 submodule: add flags to ok_to_remove_submoduleStefan Beller, Dec 19, 2016
  16. David TurnerDec 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.