From: Junio C Hamano <gitster@pobox•com>
To: Eric Sunshine <sunshine@sunshineco•com>
Cc: Brian Gernhardt <brian@gernhardtsoftware•com>,
"git\@vger.kernel.org List" <git@vger•kernel.org>
Subject: Re: t3010 broken by 2eac2a4
Date: Fri, 23 Aug 2013 10:15:55 -0700 [thread overview]
Message-ID: <xmqqk3jcpbuc.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAPig+cRumXHk-30yvS8Q2xvOxA0qEEXaD7=iJo_X26HL-YRRJg@mail.gmail.com> (Eric Sunshine's message of "Fri, 23 Aug 2013 05:19:52 -0400")
Eric Sunshine <sunshine@sunshineco•com> writes:
> On Fri, Aug 23, 2013 at 1:36 AM, Junio C Hamano <gitster@pobox•com> wrote:
>> Eric Sunshine <sunshine@sunshineco•com> writes:
>>
>>> I sent a patch [1] which resolves the problem, although the solution
>>> is not especially pretty (due to some ugliness in the existing
>>> implementation).
>>
>> Yeah, thanks.
>>
>> I tend to agree with you that fixing the "icase" callee not to rely
>> on having the trailing slash (which is looking past the end of the
>> given string), instead of working that breakage around on the
>> caller's side like your patch did, would be a better alternative,
>> though.
>
> My concern with fixing directory_exists_in_index_icase() to add the
> '/' itself was that it would have to copy the string to make space for
> the '/', which could be expensive. However, I reworked the code so
> that the existing strbufs now get passed to
> directory_exists_in_index_icase(), which allows it to add its needed
> '/' without duplicating the string. So, the trailing '/' requirement
> of directory_exists_in_index_icase() is now a private implementation
> detail, placing no burden on the caller.
When 5102c617 (Add case insensitivity support for directories when
using git status, 2010-10-03) added the directories to the name-hash
with trailing slash, there was only a single name hash table to
which both real cache entries and leading directory prefixes are
registered, so it made some sense to register them with trailing
slashes so that we can tell what kind of entry is being returned.
But since 2092678c (name-hash.c: fix endless loop with
core.ignorecase=true, 2013-02-28), these directory entries that are
not the cache entries are kept track of in a separate hashtable,
which makes me wonder if it still makes sense to register
directories with trailing slashes.
And if we stop doing that (and instead if we shrunk the namelen when
an unconverted caller asks for a name with a trailing slash to see
if a directory exists in the index), wouldn't it automatically fix
the directory_exists_in_index_icase()? It does not need to assume
that dirname[len] has '/'; after all, it may not even be a valid
memory location in the first place.
next prev parent reply other threads:[~2013-08-23 17:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-21 20:31 t3010 broken by 2eac2a4 Brian Gernhardt
2013-08-21 21:41 ` Junio C Hamano
2013-08-22 20:54 ` Eric Sunshine
2013-08-22 21:16 ` Junio C Hamano
2013-08-22 21:22 ` Eric Sunshine
2013-08-22 21:32 ` Junio C Hamano
2013-08-22 21:35 ` Eric Sunshine
2013-08-22 21:43 ` Junio C Hamano
2013-08-22 21:59 ` Eric Sunshine
2013-08-22 22:53 ` Eric Sunshine
2013-08-22 23:12 ` Junio C Hamano
2013-08-22 23:15 ` Eric Sunshine
2013-08-23 4:32 ` Eric Sunshine
2013-08-23 5:36 ` Junio C Hamano
2013-08-23 9:19 ` Eric Sunshine
2013-08-23 17:15 ` Junio C Hamano [this message]
2013-08-23 18:51 ` Jeff King
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=xmqqk3jcpbuc.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=brian@gernhardtsoftware$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=sunshine@sunshineco$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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