Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pathspec matching #967

Merged
merged 18 commits into from
Aug 14, 2023
Merged

pathspec matching #967

merged 18 commits into from
Aug 14, 2023

Conversation

Byron
Copy link
Member

@Byron Byron commented Aug 6, 2023

Follow-up of #964

Tasks

  • support for defaults (these can be global)
  • normalization
  • match baseline
  • the same for excludes (order, side-effects, special-cases)
  • literal tests
  • assure file/ doesn't match a file as it's supposed to be dir
  • special cases like ! in path to assure we handle patterns correctly.
  • extra-diligence when it comes to case-insensitive matching around prefixes
  • common-prefix-len optimization - query the common prefix for now
  • match with attribute matching when testing against index
  • gix index entries with pathspec support, along with utilities to handle the CWD within the repo to affect the pathspec

Out of Scope/Next PR

Use pathspec matching for…

  • is-active checks (following the rules) - note that these are only coming from $GIT_DIR/config, and check where exactly they are from
  • Use actual defaults in AsPathSpec once gix has a way to generate them (it's trivial, but needs doing, with gix-sec integration)
  • todo(pathspec) - mostly performance and API
  • submodules in gix
  • gix index entries with --recurse-submodules

Research Notes

  • git ls-files <spec> is generally really, really fast and only on webkit with 360k paths and 'some difficult patterns' one can see any sort of slowdown. hyperfine 'git ls-files *test* foo bar **ring**' 'git ls-files' shows one though in webkit.

@Byron Byron force-pushed the pathspec-matching branch 4 times, most recently from 517cb1d to cbbc8b1 Compare August 9, 2023 17:38
… of spec.

That spec is indicated with `:`.
This allows the caller to control what happens if certain configuration
flags of pathsepcs aren't set.

These are typically provided by pathspec configuration environment variables.
It actually wasn't used in the base implementation at all
…llows controlling base flags.

Previously, this method would assume that path globs should stop at slashes, and now
this setting can be controlled by the caller.
@Byron Byron force-pushed the pathspec-matching branch 3 times, most recently from e62ec5e to f5409dc Compare August 11, 2023 09:51
@Byron Byron force-pushed the pathspec-matching branch 3 times, most recently from 451a2c2 to 3b50b97 Compare August 13, 2023 08:44
@Byron Byron force-pushed the pathspec-matching branch 3 times, most recently from dc724d7 to 9a39574 Compare August 13, 2023 19:37
@Byron Byron force-pushed the pathspec-matching branch 2 times, most recently from ed5a866 to f3480d3 Compare August 14, 2023 09:22
…ous search.

This allows to perform a search once, finding all attributes, and
then copy the results over to another outcome, typically one with
selected attributes.
…on`.

This makes it easier for the caller as they won't have to call transpose anymore.
…th a given prefix.

This is useful to limit entry traversal and thus do less work.
This adds support for more simple git style, which is faster and thus
allows for more direct comparisons to `git ls-files`.
@Byron Byron merged commit 9f4dfe0 into main Aug 14, 2023
17 checks passed
@Byron Byron deleted the pathspec-matching branch August 14, 2023 10:33
@Byron Byron mentioned this pull request Aug 14, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant