cargo-count
cargo-count copied to clipboard
Everything excluded when using exclude-all-then-add-some .gitignore
Any updates on this?
@nabijaczleweli Sorry not yet, I've been spending my limited spare time on clap. I'm hoping to get some of this looked at early next week.
Hi, I was playing around with the code trying to fix this. I thought I'll just note down my observations:
- This problem actually originates at gitignore.rs repo. I've raised a bug for this case.
- Ideally shouldn't the
get_all_files
fn begitignore.get_included_files().filter(|fp| !exclude.contains(fp))
. The only thing would be it might not honorfollow_links
- I was wondering what's the point of having the
follow_links
options? It looks like the current code wouldn't handle circular links (upstream gitignore wouldn't either). Also symlinks might point outside the current git directory in which case does it make sense to follow it? And if a file is in the repo but is a symlink won't it get included by the non-symlinked path?
Just my $0.02. Please tell me what you think
I was wondering what's the point of having the follow_links options?
I can't remember why I originally added it, but it wasn't really meant to do anything too sophisticated like detecting circular links. In all honesty we could probably remove that options and still be fine.
In that case I can send a pull request to remove this option and replace get_all_files which uses gitignore.get_included_files. Should I go ahead and do that?
@rabisg I apologize, I've had other projects and my day job take priority here. I'd be more than happy to take a PR on this.
Seems to be a problem with the .gitignore
handling. With an empty crate generated with cargo new
, it says there isn't "any file matching the criteria". If I remove the .gitignore
, it outputs the line counts as expected.
Just a heads up. My PR got merged in https://github.com/nathankleyn/gitignore.rs/pull/12 and v1.0.6 was released. Since I cannot devote time to this right now if someone wants to update this repo I'll be happy to help
@kbknapp All you should need to do right now to fix this would be to either update the Cargo.toml to have 1.0.6 as the min version for gitignore, or just to remove the Cargo.lock and rebuild. Then you would only need to release a new version to crates.io, and it would work. Even just cloning the repo works right now, just not the version on crates.io.