Re: [PATCH v15 07/27] bisect--helper: `bisect_reset` shell function in C
- From
Pranit Bauva <pranit.bauva@gmail.com>
- Date
- Nov 17, 2016, 03:56 UTC
- Message-ID
- <CAFZEwPNtSAKut3t0n-WxZyoV=xuf9-s7XJO9gvGQWVsL3vTouw@mail.gmail.com>
- In-Reply-To
- <1190e37e-d54a-7dbf-412d-8dff90ca677a@gmx.net>
Hey Stephan,
On Thu, Nov 17, 2016 at 4:53 AM, Stephan Beyer <s-beyer@gmx.net> wrote:
Show 20 quoted lines
> Hi,
>
> On 10/14/2016 04:14 PM, Pranit Bauva wrote:
>> diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
>> index 4254d61..d84ba86 100644
>> --- a/builtin/bisect--helper.c
>> +++ b/builtin/bisect--helper.c
>> @@ -84,12 +89,47 @@ static int write_terms(const char *bad, const char *good)
>> return (res < 0) ? -1 : 0;
>> }
>>
>> +static int bisect_reset(const char *commit)
>> +{
>> + struct strbuf branch = STRBUF_INIT;
>> +
>> + if (!commit) {
>> + if (strbuf_read_file(&branch, git_path_bisect_start(), 0) < 1) {
>> + printf("We are not bisecting.\n");
>
> I think this string should be marked for translation.True. Thanks!
Show 15 quoted lines
>> + return 0;
>> + }
>> + strbuf_rtrim(&branch);
> [...]
>> @@ -121,6 +163,10 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
>> if (argc != 0)
>> die(_("--bisect-clean-state requires no arguments"));
>> return bisect_clean_state();
>> + case BISECT_RESET:
>> + if (argc > 1)
>> + die(_("--bisect-reset requires either zero or one arguments"));
>
> This error message is imho a little unspecific (but this might not be an
> issue because bisect--helper commands are not really exposed to the
> user). Maybe "--bisect-reset requires either no argument or a commit."?That sounds good.
>> + return bisect_reset(argc ? argv[0] : NULL);
>> default:
>> die("BUG: unknown subcommand '%d'", cmdmode);
>> }Regards, Pranit Bauva