From: Junio C Hamano <gitster@pobox.com>
To: Antoine Pelisse <apelisse@gmail.com>
Cc: git <git@vger.kernel.org>
Subject: Re: [PATCH v2 03/10] mailmap: remove email copy and length limitation
Date: Wed, 09 Jan 2013 09:56:24 -0800 [thread overview]
Message-ID: <7vbocy6y0n.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <7vfw2a6yh5.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Wed, 09 Jan 2013 09:46:30 -0800")
Junio C Hamano <gitster@pobox.com> writes:
> Antoine Pelisse <apelisse@gmail.com> writes:
>
>>> +static struct string_list_item *lookup_prefix(struct string_list *map,
>>> + const char *string, size_t len)
>>> +{
>>> + int i = string_list_find_insert_index(map, string, 1);
>>> + if (i < 0) {
>>> + /* exact match */
>>> + i = -1 - i;
>>> + /* does it match exactly? */
>>> + if (!map->items[i].string[len])
>>> + return &map->items[i];
>>
>> I'm not sure the condition above is necessary, as I don't see why an
>> exact match would not be an exact match.
>
> You have a overlong string "ABCDEFG", but you only want to look for
> "ABCDEF", i.e. len=6. The string_list happens to have an existing
> string "ABCDEFG". The insert-index function will report an exact
> match, but that does not mean you found what you are looking for.
To put it another way, we can further clarify the situation by
rewording the comment "Does it match exactly?", perhaps like this
if (i < 0) {
/* exact match */
i = -1 - i;
if (!string[len])
return &map->items[i];
/*
* It matched exactly even to the cruft at the end
* of the string, so it is not really a match.
*/
}
next prev parent reply other threads:[~2013-01-09 17:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-08 0:10 [PATCH v2 00/10] reroll of ap/log-mailmap Junio C Hamano
2013-01-08 0:10 ` [PATCH v2 01/10] string-list: allow case-insensitive string list Junio C Hamano
2013-01-10 21:35 ` René Scharfe
2013-01-08 0:10 ` [PATCH v2 02/10] Use split_ident_line to parse author and committer Junio C Hamano
2013-01-08 0:10 ` [PATCH v2 03/10] mailmap: remove email copy and length limitation Junio C Hamano
2013-01-09 17:35 ` Antoine Pelisse
2013-01-09 17:46 ` Junio C Hamano
2013-01-09 17:56 ` Junio C Hamano [this message]
2013-01-08 0:10 ` [PATCH v2 04/10] mailmap: simplify map_user() interface Junio C Hamano
2013-01-08 0:10 ` [PATCH v2 05/10] mailmap: add mailmap structure to rev_info and pp Junio C Hamano
2013-01-08 0:10 ` [PATCH v2 06/10] pretty: use mailmap to display username and email Junio C Hamano
2013-01-08 0:10 ` [PATCH v2 07/10] log: add --use-mailmap option Junio C Hamano
2013-01-08 0:10 ` [PATCH v2 08/10] test: add test for " Junio C Hamano
2013-01-08 0:10 ` [PATCH v2 09/10] log: grep author/committer using mailmap Junio C Hamano
2013-01-08 0:10 ` [PATCH v2 10/10] log: add log.mailmap configuration option Junio C Hamano
2013-01-08 7:27 ` [PATCH v2 00/10] reroll of ap/log-mailmap Antoine Pelisse
2013-01-08 7:39 ` Junio C Hamano
2013-01-08 8:02 ` Junio C Hamano
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=7vbocy6y0n.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=apelisse@gmail.com \
--cc=git@vger.kernel.org \
/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).