Skip to content

IgnoreNode should not always use path match as true #105

Open
@Jenson3210

Description

@Jenson3210

Version

latest

Operating System

Linux/Unix, MacOS

Bug description

a .gitignore file containing a single ignore rule for a directory fails to match correctly.

/directory/nested/

should be ignoring /directory/nested/again directory

Actual behavior

the result given back is CHECK_PARENT

Expected behavior

the result given back is IGNORED

Relevant log output

No response

Other information

I have a test showcasing this behaviour in my fork (will link commit). Here more insights/debugging can be found.

Caused by the fact that IgnoreNode is always passing true as pathMatch to the rule.isMatch

    @Test
    public void fastIgnoreRuleForNestedDirectory() {
        //This PASSES as isMatch returns true
        FastIgnoreRule ignoreRule1 = new FastIgnoreRule("/directory/nested/");
        assertTrue(ignoreRule1.isMatch("/directory/nested/again", true, false));

        //This FAILS as isMatch returns false
        FastIgnoreRule ignoreRule2 = new FastIgnoreRule("/directory/nested/");
        assertTrue(ignoreRule2.isMatch("/directory/nested/again", true, true));
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions