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

Fix check for nested sparse include #38

Merged
merged 2 commits into from
Jan 30, 2024
Merged

Fix check for nested sparse include #38

merged 2 commits into from
Jan 30, 2024

Conversation

cmbartschat
Copy link

@cmbartschat cmbartschat commented Jan 30, 2024

Context

The test case from #37 had a typo/mistake in it so I wasn't testing what I thought I was testing.

My logic was looking at /A/B/C/ and seeing that /A/B/ matched !/A/*/, so it was considering it valid, but it actually isn't, because there needs to be a /A/B/ rule to allow /A/B/C/ to be reached.

/*
!/A/*/
/A/B/C/

Testing

  • Tests in monorepo pass
  • make libgit2_tests && ./libgit2_tests -ssparse::paths passes
  • Local g8 shows correct behavior, 1.6.0 is broken.
    Screenshot 2024-01-29 at 8 17 49 PM

@cmbartschat cmbartschat requested a review from erikmchut January 30, 2024 04:28
@@ -185,7 +185,8 @@ static int parse_sparse_file(
git_attr_fnmatch *parent_match;
git_vector_foreach(&attrs->rules, k, parent_match) {
if (pattern_matches_path(parent_match, &parent_path, parent_length)) {
matched = true;
matched = !HAS_FLAG(parent_match, GIT_ATTR_FNMATCH_NEGATIVE);
break;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tabs vs spaces

@cmbartschat cmbartschat merged commit db3b60a into main Jan 30, 2024
9 of 25 checks passed
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.

2 participants