ggreer / the_silver_searcher

A code-searching tool similar to ack, but faster.
http://geoff.greer.fm/ag/
Apache License 2.0
26.19k stars 1.43k forks source link

~/.ignore isn't respected (while ~/.agignore is) #1097

Open skrattaren opened 7 years ago

skrattaren commented 7 years ago

ag is said to prefer .ignore files (#974), while in reality ~/.ignore is, well, ignored:

 % ls
file.txt  image.png  log.log

 % ag -l ./
file.txt
log.log

 % echo '*.log' > ~/.ignore
 % ag -l ./
file.txt
log.log

 % ln -s ~/.ignore ~/.agignore
 % ag -l ./
file.txt
 % uname -mo
x86_64 GNU/Linux
 % ag --version
ag version 1.0.3

Features:
  +jit +lzma +zlib
skrattaren commented 7 years ago

…and in 2.0 there seems to be no way at all to keep global ignore file =(

tonglil commented 7 years ago

For me in 2.0, ~/.agignore works when just ~/.ignore does not.

$ ls -la ~ | ag ignore
lrwxr-xr-x     1 x staff           21 Jun 15 11:38 .agignore -> /Users/207383/.ignore
lrwxr-xr-x     1 x 1490099278      27 Jun  7  2016 .gitignore_global -> .dotfiles/.gitignore_global
-rw-r--r--     1 x 1490099278      27 May 31  2016 .hgignore_global
lrwxr-xr-x     1 x 1490099278      17 Oct 20  2016 .ignore -> .dotfiles/.ignore

$ ag 'ignore' ~/.gitignore_global ~/.hgignore_global 

$ ag --version 
ag version 2.0.0

Features:
  +jit +lzma +zlib
Trevoke commented 7 years ago

I'm on OSX and for me ~/.agignore works and ~/.ignore does not.

ag 2.1.0

cmal commented 5 years ago
$ uname -mrv
18.5.0 Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X86_64 x86_64

$ ag --version

ag version 2.2.0

Features:
  +jit +lzma +zlib

$ stat -f "%a %m %c" .ignore
1558601129 1558601015 1558601015

$ stat -f "%a %m %c" .agignore
1558601015 1558600467 1558600467

$ ag SearchBar > /dev/null

$ stat -f "%a %m %c" .ignore
1558601644 1558601015 1558601015

$ stat -f "%a %m %c" .agignore
1558601015 1558600467 1558600467

$ rm .ignore

$ stat -f "%a %m %c" .agignore
1558601015 1558600467 1558600467

$ ag SearchBar > /dev/null

$ stat -f "%a %m %c" .agignore
1558601015 1558600467 1558600467

It seems .ignore is used, and .agignore is never used on Mac OS.

kurko commented 3 years ago

I think only ./.ignore is being used. ~/.ignore is not being used at all. I'm having to resort to alias ag='ag --path-to-ignore ~/.ignore' for it to work.

jgehrcke commented 3 years ago

Documentation here: https://github.com/ggreer/the_silver_searcher/wiki/Advanced-Usage#ignoring-files

The .agignore file was removed in favor of .ignore as part of the 2.0.0 release.

Integralist commented 3 years ago

Ah @kurko is seeing what I'm seeing and so sounds like --path-to-ignore is what I needed (thank you! I didn't know that flag existed)

talwrii commented 3 years ago

Following @Trevoke , I'm on 2.2.0 on OSX with ag installed via brew. .agignore works .ignore does not