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

vdoc: rewrite and extend vdocignore #21314

Merged
merged 5 commits into from
Apr 20, 2024
Merged

Conversation

ttytm
Copy link
Member

@ttytm ttytm commented Apr 19, 2024

After working on an improved status quo to also have a good fallback, this PR approaches to rewrite and to extend .vdocignore.

  • It adds pattern support.

    Until now to ignore a and the same pattern in a sub-directory (b/a) it is required to set the exact path for every subdirectory. Now it is sufficient to set the pattern

Ignore Goal Current Updated
a
a/b
b/c/a
a
a/b
b/c/a
a
  • Similar to gitignore a pattern starting with / will be treated as relative pattern.
    -> /a will ignore /a but not /b/a.
    -> /c/d will ignore /c/d but not /b/c/d

  • Treats lines starting with # as comments

  • Removes the functionality that an empty ignore file ignores all in its directory.

@JalonSolov
Copy link
Contributor

Would be nice, of course, to get full .gitignore paths, so you could have

**/a/

meaning every a subdir... /a, /b/a, /1/2/3/4/5/6/7/a, etc.

At the very least, support trailing slash means subdir, while no trailing slash means file.

@ttytm
Copy link
Member Author

ttytm commented Apr 19, 2024

Agree about the wildcards. Would approach it at a later point, or if someone else does it it's cool as well.
Tho in a gitignore it's not that only a trailing slash means a directory, a dir is also true for a pattern without a trailing slash.

@ttytm ttytm force-pushed the vdoc/rewrite-ignore branch 7 times, most recently from 1020d83 to 72b66f0 Compare April 19, 2024 21:29
@ttytm ttytm marked this pull request as ready for review April 19, 2024 21:32
@ttytm ttytm force-pushed the vdoc/rewrite-ignore branch 2 times, most recently from 7d27afd to 66e52c6 Compare April 19, 2024 21:49
@ttytm ttytm marked this pull request as draft April 19, 2024 21:59
@JalonSolov
Copy link
Contributor

Yep, but a trailing slash forces it to only match subdirs.

@ttytm ttytm force-pushed the vdoc/rewrite-ignore branch 2 times, most recently from c095106 to 0fe782b Compare April 19, 2024 23:18
@ttytm
Copy link
Member Author

ttytm commented Apr 19, 2024

Yep, but a trailing slash forces it to only match subdirs.

Yep, a test for this is added.

To give more info: Our .vdocignore is in general a little simpler then a .gitignore since it only looks for modules that end with .v. So the test has an ignore pattern name.v/, a directory with the name name.v and also file name.v, testing that only the directory is ignored.

@ttytm ttytm force-pushed the vdoc/rewrite-ignore branch 2 times, most recently from 0c926c7 to e71781d Compare April 20, 2024 00:26
@ttytm ttytm marked this pull request as ready for review April 20, 2024 00:26
@ttytm ttytm force-pushed the vdoc/rewrite-ignore branch 4 times, most recently from 3881a62 to 69bb110 Compare April 20, 2024 00:42
@spytheman spytheman merged commit 7f7b6c3 into vlang:master Apr 20, 2024
44 checks passed
@ttytm ttytm deleted the vdoc/rewrite-ignore branch April 20, 2024 09:50
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.

3 participants