Ripgrep: support global gitignore config

Created on 21 Sep 2016  Â·  10Comments  Â·  Source: BurntSushi/ripgrep

e.g., $HOME/.config/git/ignore or $XDG_CONFIG_HOME/git/ignore or whatever file is specified by the configuration variable core.excludesFile. Another source might be $GIT_DIR/info/exclude.

bug

All 10 comments

While supporting core.excludesFile or a global .gitignore seems easy enough, support $GIT_DIR/info/exclude is actually a little tricky. There are two issues:

  1. Firstly, it's an additional file to stat for in _every_ directory we descend. That list of files is currently at two (.rgignore and .gitignore), and I know we'd like to bump it to three so we can include .hgignore too. Adding $GIT_DIR/info/exclude would bring this list to 4 entries. Owch.
  2. A $GIT_DIR/info/exclude file seems to have precedence strictly lower than _all_ .gitignore files in the current directory all the way up to the parent directory. (See man gitignore). This means we need to: 1) Check all .gitignore files, 2) then check all $GIT_DIR/info/exclude files and finally 3) check the global gitignore config.

We should at least support core.excludesFile. Supporting $GIT_DIR/info/exclude seems like it might cost us too much for little gain. (My impression is that it isn't widely used.)

My 2¢: I've used $GIT_DIR/info/exclude in practically every repo I've worked on for a significant period of time, whereas I've never used core.excludesFile, so for me the priorities there would be exactly reversed.

One alternative solution might be to have a parameter or separate tool to auto-generate one or more .ignore files based on these sources that are otherwise trickier to handle. The usefulness of this is predicated on people not committing their .ignore files. I'm not sure how likely that is...

Maybe there should be an option for specifying additional (or replacement) ignore files manually?

@vi That's always an option, but it's not particularly satisfying.

I also think $GIT_DIR/info/exclude would be more useful than core.excludesFile. But if there is a worry about performance, I think the flag for specifying extra ignore files is best. It can always be aliased or put in a short function.

(Just for some counterbalance -- I'm certainly in the bucket of people you originally mentioned. $XDG_CONFIG_HOME/git/ignore is way way way more important for me.)

core.excludesFile for me

Actually, changed my mind. core.excludesFile for me too. How high on the priority list is this feature btw?

It's being worked on.

On Oct 20, 2016 5:51 PM, "Ramith Jayatilleka" [email protected]
wrote:

Actually, changed my mind. core.excludesFile for me too. How high on the
priority list is this feature btw?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/BurntSushi/ripgrep/issues/9#issuecomment-255238570,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAb34puYJ9ir4rQPWTT_kcOTPAHu0mlWks5q1-JegaJpZM4KCvdR
.

Fixed in #202.

Was this page helpful?
0 / 5 - 0 ratings