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

2016-12-20 Thread Stefan Beller
On Tue, Dec 20, 2016 at 1:47 PM, Johannes Sixt wrote: > This does not explain why the *complete and detailed* invocation must be > reported. eh. I tried to say that a report that looks like a *complete and detailed* invocation should be such, and not be misleading (and e.g. miss

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

2016-12-20 Thread Johannes Sixt
Am 20.12.2016 um 21:49 schrieb Stefan Beller: On Tue, Dec 20, 2016 at 12:12 PM, Johannes Sixt wrote: I have to ask, though: Is it so much necessary to report the exact command line in an error message? Have a look at https://github.com/git/git/blob/master/submodule.c#L1122

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

2016-12-20 Thread Stefan Beller
On Tue, Dec 20, 2016 at 12:12 PM, Johannes Sixt wrote: > Am 20.12.2016 um 20:23 schrieb Stefan Beller: >> >> 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

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

2016-12-20 Thread Johannes Sixt
Am 20.12.2016 um 20:23 schrieb Stefan Beller: 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

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

2016-12-20 Thread Stefan Beller
On Tue, Dec 20, 2016 at 10:33 AM, Johannes Sixt 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)

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

2016-12-20 Thread Johannes Sixt
Am 20.12.2016 um 19:33 schrieb Johannes Sixt: Am 20.12.2016 um 00:28 schrieb Stefan Beller: +void run_command_or_die(struct child_process *cmd) +{ +if (finish_command(cmd)) +report_and_die(cmd, "run"); And here as well. Oh, and BTW, this one wraps only finish_command, not

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

2016-12-20 Thread Johannes Sixt
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(, "git "); + for (i = 0; cmd->argv[i]; ) +

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

2016-12-19 Thread Stefan Beller
On Mon, Dec 19, 2016 at 3:32 PM, Brandon Williams wrote: >> + strbuf_addstr(, "git "); >> + for (i = 0; cmd->argv[i]; ) > > Missing the increment of i here. Doh :( When writing the code I was undecided between using an incremental loop "for (i = 0;

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

2016-12-19 Thread Brandon Williams
On 12/19, Stefan Beller wrote: > In a later patch we want to report the exact command that we run in the > error message. Add a convenient way to the run command API that runs the > given command or reports the exact command as failure. > > Signed-off-by: Stefan Beller > ---

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

2016-12-19 Thread Stefan Beller
In a later patch we want to report the exact command that we run in the error message. Add a convenient way to the run command API that runs the given command or reports the exact command as failure. Signed-off-by: Stefan Beller --- run-command.c | 28