Re: Issue 1068 in include-what-you-use: --keep is being ignored

1 view
Skip to first unread message

notifi...@include-what-you-use.org

unread,
Jul 16, 2022, 10:26:58 AM7/16/22
to include-wh...@googlegroups.com
Comment #1 on issue 1068 by kimgr: --keep is being ignored
https://github.com/include-what-you-use/include-what-you-use/issues/1068

Note that the help text for `--keep` says "glob". It's matched against the full path of the include, to allow things like `--keep="*/magic/*"`.

So it should work if you do: `--keep="*nxt_ftm.h"`.

That is a little confusing, though, so if you're interested in improving the matching in `ShouldKeepIncludeFor`, patches are welcome. I suppose it could try to match the basename if the pattern is _not_ a glob. Or try both path and basename, not sure.


notifi...@include-what-you-use.org

unread,
Jul 24, 2022, 4:00:35 PM7/24/22
to include-wh...@googlegroups.com
Comment #2 on issue 1068 by alejandro-colomar: --keep is being ignored
https://github.com/include-what-you-use/include-what-you-use/issues/1068

> Note that the help text for `--keep` says "glob".

Hmm, I read that, but wondered why a glob and not a regex. I didn't know if the glob was compared against the whole path of the file in the filesystem, or the relative path noted in the include line.

> It's matched against the full path of the include, to allow things like `--keep="*/magic/*"`.
>
> So it should work if you do: `--keep="*nxt_ftm.h"`.
>
> That is a little confusing, though, so if you're interested in improving the matching in `ShouldKeepIncludeFor`, patches are welcome. I suppose it could try to match the basename if the pattern is _not_ a glob. Or try both path and basename, not sure.

I'm not sure. I'd keep it as is for now, but maybe document it more explicitly.




Reply all
Reply to author
Forward
0 new messages