rust-lang / mdBook

Create book from markdown files. Like Gitbook but implemented in Rust
https://rust-lang.github.io/mdBook/
Mozilla Public License 2.0
18.13k stars 1.63k forks source link

`.*` in `.gitignore` causes mdbook to ignore everything #1492

Open simonmichael opened 3 years ago

simonmichael commented 3 years ago

If you have .* in .gitignore, intending to make git and/or mdbook ignore dotted files, mdbook watch/serve will ignore everything. I suspect mdbook's parsing of .gitignore is not fully git compliant.

weihanglo commented 3 years ago

There is a weird feature(?) in gitignore.rs: it appends an * if the pattern is unanchored. https://github.com/nathankleyn/gitignore.rs/blob/590793e8/src/pattern.rs#L92-L95.

I propose using ignore instead. ignore is more maintained and provides hands of configuration for global/local .gitignore/.ignore files. This can make other ideas (#1187, #1440, #1487) more likely become true. We can moreover safely remove fn find_gitignore().


Off topic. The current description of gitignore in mdbook guide is incorrect. We actually respect .gitignore in parent dirs.