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

Re: [PATCH] log -L: improve error message on malformed argument

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Apr 16, 2015, 21:49 UTC
Message-ID
<CAPig+cRqJdi6skbszkwFFauqh4qWJDxMq5GdcFuKrJj9wtBvoQ@mail.gmail.com>
In-Reply-To
<xmqqpp73hhnm.fsf@gitster.dls.corp.google.com>
On Thu, Apr 16, 2015 at 5:45 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 30 quoted lines
> Matthieu Moy <Matthieu.Moy@imag.fr> writes:
>
>> The old message did not mention the :regex:file form.
>>
>> To avoid overly long lines, split the message into two lines (in case
>> item->string is long, it will be the only part truncated in a narrow
>> terminal).
>>
>> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
>> ---
>>  line-log.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/line-log.c b/line-log.c
>> index a490efe..e725248 100644
>> --- a/line-log.c
>> +++ b/line-log.c
>> @@ -575,7 +575,8 @@ parse_lines(struct commit *commit, const char *prefix, struct string_list *args)
>>
>>               name_part = skip_range_arg(item->string);
>>               if (!name_part || *name_part != ':' || !name_part[1])
>> -                     die("-L argument '%s' not of the form start,end:file",
>> +                     die("invalid -L argument '%s'.\n"
>> +                         "It should be of the form start,end:file or :regex:file.",
>>                           item->string);
>>               range_part = xstrndup(item->string, name_part - item->string);
>>               name_part++;
>
> You forgot to update tests to match their expectations?  4211.20
> wants to see 'argument.*not of the form', it seems.
An alternate wording might be:
    "-L argument not 'start,end:file' or ':regex:file': %s"

This can still wrap onscreen but the important information (the two forms accepted by -L) is at the head of the error message, and the variable (user-supplied) bit is at the end after the colon, in typical error message form.

Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 7 in “log -L: improve error message on malformed argument”
  1. log -L: improve error message on malformed argumentMatthieu Moy, Apr 16, 2015
  2. Junio C HamanoApr 16, 2015
  3. Junio C HamanoApr 16, 2015
  4. Eric SunshineApr 16, 2015
  5. Junio C HamanoApr 17, 2015
  6. Documentation: change -L:<regex> to -L:<funcname>Matthieu Moy, Apr 19, 2015
  7. Ramsay JonesApr 20, 2015

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.