git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Johannes Sixt <j6t@kdbg.org>
Cc: Junio C Hamano <gitster@pobox.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>,
	Brandon Williams <bmwill@google.com>,
	"brian m. carlson" <sandals@crustytoothpaste.net>,
	David Turner <David.Turner@twosigma.com>
Subject: Re: [PATCHv4 3/5] run-command: add {run,start,finish}_command_or_die
Date: Tue, 20 Dec 2016 11:23:31 -0800	[thread overview]
Message-ID: <CAGZ79kYNKWfnEXWJfyRUutFyaQiRD9qW--LkK4Nbwdf7FtdPQA@mail.gmail.com> (raw)
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:
> 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

  parent reply	other threads:[~2016-12-20 19:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19 23:28 [PATCHv4 0/5] git-rm absorbs submodule git directory before deletion Stefan Beller
2016-12-19 23:28 ` [PATCHv4 1/5] submodule.h: add extern keyword to functions Stefan Beller
2016-12-19 23:28 ` [PATCHv4 2/5] submodule: modernize ok_to_remove_submodule to use argv_array Stefan Beller
2016-12-19 23:28 ` [PATCHv4 3/5] run-command: add {run,start,finish}_command_or_die Stefan Beller
2016-12-19 23:32   ` Brandon Williams
2016-12-19 23:35     ` Stefan Beller
2016-12-20 18:33   ` Johannes Sixt
2016-12-20 18:54     ` Johannes Sixt
2016-12-20 19:23     ` Stefan Beller [this message]
2016-12-20 20:12       ` Johannes Sixt
2016-12-20 20:49         ` Stefan Beller
2016-12-20 21:47           ` Johannes Sixt
2016-12-20 22:07             ` Stefan Beller
2016-12-19 23:28 ` [PATCHv4 4/5] submodule: add flags to ok_to_remove_submodule Stefan Beller
2016-12-19 23:28 ` [PATCHv4 5/5] rm: absorb a submodules git dir before deletion Stefan Beller
2016-12-19 23:35 ` [PATCHv4 0/5] git-rm absorbs submodule git directory " David Turner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGZ79kYNKWfnEXWJfyRUutFyaQiRD9qW--LkK4Nbwdf7FtdPQA@mail.gmail.com \
    --to=sbeller@google.com \
    --cc=David.Turner@twosigma.com \
    --cc=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).