Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
skrattaren opened this issue May 31, 2017 · 8 comments
Open

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

skrattaren opened this issue May 31, 2017 · 8 comments

Comments

@skrattaren
Copy link

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
Copy link
Author

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

@tonglil
Copy link

tonglil commented Jun 15, 2017

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
Copy link

Trevoke commented Sep 11, 2017

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

ag 2.1.0

robertknight added a commit to robertknight/mandrawer that referenced this issue May 29, 2018
Despite some confusion in the docs, `.agignore` does appear to work as a
global ignore file. See ggreer/the_silver_searcher#1097
@cmal
Copy link

cmal commented May 23, 2019

$ 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
Copy link

kurko commented Nov 20, 2020

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
Copy link

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
Copy link

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
Copy link

talwrii commented Jul 15, 2021

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

mmrwoods added a commit to mmrwoods/dotfiles that referenced this issue Apr 1, 2022
Actually, it seems this is not true, both ag and rg support .ignore
files anywhere in the directories being search, but only rg supports
a global .ignore, whereas ag (v2.2.0) requires a global .agignore

See ggreer/the_silver_searcher#1097

This reverts commit a239c01.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants