rizsotto / Bear

Bear is a tool that generates a compilation database for clang tooling.
GNU General Public License v3.0
4.83k stars 313 forks source link

paths_to_include/exclude don't work if path ends in '/' #539

Closed Pennycook closed 1 year ago

Pennycook commented 1 year ago

Describe the bug While experimenting with the include/exclude functionality of bear for a large project, I tried a file like the following:

    "content": {
      "include_only_existing_source": true,
      "paths_to_include": ["/path/to/source/"],
      "paths_to_exclude": [],
      "duplicate_filter_fields": "file_output"
    },

This resulted in an empty configuration file. Correcting the path to "/path/to/source" worked as expected.

To Reproduce Specify a path ending in a /.

Expected behavior I expected these paths to work both with and without a final / character.

Environment:

Additional context We often recommend that people use Bear to generate compilation databases for use with Code Base Investigator. Limiting the compilation database to only the files that a developer is responsible for maintaining limits the amount of time Code Base Investigator needs to spend parsing code, and may result in more accurate code divergence calculations.

rizsotto commented 1 year ago

Thanks @Pennycook for the report. I've made a fix for this, will be released soon.