the_silver_searcher icon indicating copy to clipboard operation
the_silver_searcher copied to clipboard

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

Open skrattaren opened this issue 7 years ago • 8 comments

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 avatar May 31 '17 19:05 skrattaren

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

skrattaren avatar Jun 06 '17 19:06 skrattaren

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

tonglil avatar Jun 15 '17 15:06 tonglil

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

ag 2.1.0

Trevoke avatar Sep 11 '17 18:09 Trevoke

$ 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.

cmal avatar May 23 '19 08:05 cmal

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.

kurko avatar Nov 20 '20 14:11 kurko

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.

jgehrcke avatar Dec 30 '20 14:12 jgehrcke

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)

Integralist avatar Feb 03 '21 15:02 Integralist

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

talwrii avatar Jul 15 '21 11:07 talwrii