scc icon indicating copy to clipboard operation
scc copied to clipboard

Feature request: support global ignore file or accept a ignore file

Open lingsamuel opened this issue 5 years ago • 7 comments

Global gitignore file often is: $HOME/.gitignore (actually configured at .gitconfig core.excludesfile).

It would be nice to use this if env var HOME no empty and .gitignore file exists, or accept a ignore file path.

Example usage: scc --ignore-file ~/.gitignore --ignore-file ./.dockerignore

lingsamuel avatar Dec 23 '20 11:12 lingsamuel

Being able to supply an ignore is not something I had considered, because it tends to have meaning based on where it is... however if we assume the supplied should work from the directories as supplied or the assumed . this should work.

Id be more in favour of having to supply the file though since that feels more explicit and avoids surprises... but maybe a seperate flag in the future to look at the $HOME... ill have a ponder on that, but happy to be convinced its a good idea here.

boyter avatar Dec 24 '20 04:12 boyter

This also means I should probably look into #150 better since the gitignore logic is currently only acceptable and not correct for all inputs which bothers me.

boyter avatar Dec 24 '20 04:12 boyter

I have a similar issue with calculating the line count in a subdir of a git repo. The parent dir (repo root) has a .gitignore and the subdir has its own .gitignore too, but I don't believe scc is reading the parent's .gitignore.

Maybe this should be its own feature request, but I'm wondering if there could be a flag for the tool to recursively check parent dirs for .gitignores and merge them all?

mmmkkaaayy avatar Jan 06 '21 08:01 mmmkkaaayy

scc by default looks for the .gitignore in each directory it is in, starting where it is run or where it is instructed to run.

Adding a rewind function to look back for git ignores is possible.... and something I have done in cs where you can use a -r argument to walk back... that's a slightly different use-case though. I suspect having you supply one or more gitignores might work well enough though...

I really need to look into the gitignore spec now and see what the edge cases are because the gitignore library used clearly is missing a lot of them.

boyter avatar Jan 06 '21 21:01 boyter

https://github.com/boyter/scc/issues/215 https://github.com/boyter/scc/issues/178 https://github.com/boyter/scc/issues/150

Going to push out to new release because this needs to be resolved in one large push.

boyter avatar Feb 23 '21 06:02 boyter