public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Brandon Williams <bmwill@google•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH 8/8] pathspec: convert parse_pathspec to take an index
Date: Thu, 11 May 2017 10:48:00 +0900	[thread overview]
Message-ID: <xmqqh90sw4dr.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170510170226.GB41649@google.com> (Brandon Williams's message of "Wed, 10 May 2017 10:02:26 -0700")

Brandon Williams <bmwill@google•com> writes:

> ls-files is the only command (that I know of) which does cache pruning
> based on the common prefix of all pathspecs given.  If there is a
> submodule named 'sub' and you provided a pathspec 'sub/', the matching
> logic can handle this but the cache pruning logic would prune all
> entries from the index which don't have a leading 'sub/' which is the
> common prefix of all pathspecs (if you didn't strip off the slash).
> Meaning you'd prune the submodule 'sub' when  you really didn't want to.
> This could probably be fixed to have the cache pruning logic to prune by
> ignoring the trailing slash always.
>
> So there's another option here if you don't feel quite right about
> piping through an index into parse_pathspec just yet.

Oh, don't get me wrong---I do not think passing an index_state
instance throughout the callchain (and perhaps later we may pass an
instance of "repository" instead) is a wrong move in the longer term
for various APIs.  I was just wondering if we have callers that can
benefit from this change immediately---manipulators like "commit" do
already use multiple instances of index_state structure.

But perhaps you are right---it may be wrong for the contents of the
current index (or any index) to affect how a pathspec element is
parsed in the first place.  If the current code (before this series)
uses the_index only for error checking, we may want to separate that
out of the parse_pathspec() callchain, so that it does not even look
at any index (not just the_index).  And that may be a better change
overall.

Thanks.


  reply	other threads:[~2017-05-11  1:48 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-09 19:17 [PATCH 0/8] convert pathspec.c to take an index parameter Brandon Williams
2017-05-09 19:17 ` [PATCH 1/8] pathspec: provide a more descriptive die message Brandon Williams
2017-05-09 19:17 ` [PATCH 2/8] submodule: add die_in_unpopulated_submodule function Brandon Williams
2017-05-09 19:18 ` [PATCH 3/8] pathspec: change PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE flag Brandon Williams
2017-05-10  5:52   ` Junio C Hamano
2017-05-10 16:16     ` Brandon Williams
2017-05-09 19:18 ` [PATCH 4/8] pathspec: rename PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP Brandon Williams
2017-05-10  5:53   ` Junio C Hamano
2017-05-09 19:18 ` [PATCH 5/8] pathspec: convert strip_submodule_slash to take an index Brandon Williams
2017-05-10  5:55   ` Junio C Hamano
2017-05-09 19:18 ` [PATCH 6/8] pathspec: convert find_pathspecs_matching_against_index " Brandon Williams
2017-05-09 19:18 ` [PATCH 7/8] pathspec: convert init_pathspec_item " Brandon Williams
2017-05-09 19:18 ` [PATCH 8/8] pathspec: convert parse_pathspec " Brandon Williams
2017-05-10  6:04   ` Junio C Hamano
2017-05-10 17:02     ` Brandon Williams
2017-05-11  1:48       ` Junio C Hamano [this message]
2017-05-11  5:04         ` Johannes Sixt
2017-05-11  5:13           ` Junio C Hamano
2017-05-11 17:36         ` Brandon Williams
2017-05-12  0:54           ` Junio C Hamano
2017-05-11 22:04 ` [PATCH v2 0/6] convert pathspec.c to take an index parameter Brandon Williams
2017-05-11 22:04   ` [PATCH v2 1/6] pathspec: provide a more descriptive die message Brandon Williams
2017-05-11 22:04   ` [PATCH v2 2/6] submodule: add die_in_unpopulated_submodule function Brandon Williams
2017-05-11 22:04   ` [PATCH v2 3/6] pathspec: remove PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE flag Brandon Williams
2017-05-11 22:04   ` [PATCH v2 4/6] ls-files: prevent prune_cache from overeagerly pruning submodules Brandon Williams
2017-05-11 22:04   ` [PATCH v2 5/6] pathspec: remove PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP Brandon Williams
2017-05-11 22:04   ` [PATCH v2 6/6] pathspec: convert find_pathspecs_matching_against_index to take an index Brandon Williams
2017-05-12  5:27   ` [PATCH v2 0/6] convert pathspec.c to take an index parameter Junio C Hamano
2017-05-12 17:29     ` Brandon Williams

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=xmqqh90sw4dr.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=bmwill@google$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /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