From: Thomas Rast <tr@thomasrast.ch>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Git List <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2 7/8] name-hash: allow dir hashing even when !ignore_case
Date: Sat, 06 Sep 2014 19:46:28 +0200 [thread overview]
Message-ID: <87ppf863rf.fsf@thomasrast.ch> (raw)
In-Reply-To: <CAPig+cRRvEUDivU=ySx7wY9qYsCYSvn68aY8s_jfX=Z=jh=Ptg@mail.gmail.com> (Eric Sunshine's message of "Sun, 23 Feb 2014 04:19:16 -0500")
Eric Sunshine <sunshine@sunshineco.com> writes:
> On Sat, Feb 22, 2014 at 4:17 AM, Thomas Rast <tr@thomasrast.ch> wrote:
>> -static void lazy_init_name_hash(struct index_state *istate)
>> +void init_name_hash(struct index_state *istate, int force_dir_hash)
>> {
>> int nr;
>>
>> if (istate->name_hash_initialized)
>> return;
>> +
>> + istate->has_dir_hash = force_dir_hash || ignore_case;
>
> This is getting a bit convoluted. Refactoring lazy_init_name_hash()
> into two functions would eliminate the complexity. For instance:
>
> void init_name_hash(struct index_state *istate)
> {
> ...pure initialization code...
> }
>
> static void init_name_hash_if_needed(struct index_state *istate)
> {
> if (ignore_case && !istate->name_hash_initialized)
> init_name_hash(istate);
> }
>
> The two existing callers of lazy_init_name_hash() in name-hash.c,
> which rely upon the lazy/ignore-case logic, would invoke the static
> init_name_hash_if_needed().
>
> The new caller in patch 8/8, which knows explicitly if and when it
> wants the hash initialized can invoke the public init_name_hash().
That unfortunately doesn't really help because the conditional part only
affects the dir hash. Callers request the name hash for other reasons,
but we only do the dir hashing when ignore_case is in effect.
So it's not simply about overriding lazy initialization, but about
choosing to trigger a specific subpart of the initialization.
--
Thomas Rast
tr@thomasrast.ch
next prev parent reply other threads:[~2014-09-06 17:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-22 9:17 [PATCH v2 0/8] log --remerge-diff Thomas Rast
2014-02-22 9:17 ` [PATCH v2 1/8] merge-recursive: remove dead conditional in update_stages() Thomas Rast
2014-02-22 9:17 ` [PATCH v2 2/8] merge-recursive: internal flag to avoid touching the worktree Thomas Rast
2014-02-22 9:17 ` [PATCH v2 3/8] merge-recursive: -Xindex-only to leave worktree unchanged Thomas Rast
2014-02-23 9:07 ` Eric Sunshine
2014-02-23 11:57 ` Thomas Rast
2014-02-23 18:42 ` Eric Sunshine
2014-02-22 9:17 ` [PATCH v2 4/8] combine-diff: do not pass revs->dense_combined_merges redundantly Thomas Rast
2014-02-22 9:17 ` [PATCH v2 5/8] Fold all merge diff variants into an enum Thomas Rast
2014-02-22 9:17 ` [PATCH v2 6/8] merge-recursive: allow storing conflict hunks in index Thomas Rast
2014-02-22 9:17 ` [PATCH v2 7/8] name-hash: allow dir hashing even when !ignore_case Thomas Rast
2014-02-23 9:19 ` Eric Sunshine
2014-09-06 17:46 ` Thomas Rast [this message]
2014-02-27 23:20 ` Junio C Hamano
2014-02-22 9:17 ` [PATCH v2 8/8] log --remerge-diff: show what the conflict resolution changed Thomas Rast
2014-02-27 0:40 ` 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=87ppf863rf.fsf@thomasrast.ch \
--to=tr@thomasrast.ch \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=sunshine@sunshineco.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.