@ 201216.1 · fetching

200110.1.1 · 755c6e5c06fc38903fa0d66be68a9c8ffa525c1b

Fix ignore patterns in subdirectories with leading slashes

Currenetly if you have an ignore file in a subdirectory "sub" with a pattern like
/ignorethis The directory sub/ignorethis will be ignored if you run ag from within sub, but it won't be ignored if you run it from sub's parent. that is

$ ag needle

will search files in sub/ignorethis, but

$ cd sub
$ ag needle

Will not. This is a bug

reading declarations

Changes to tests/ignore_slash_in_subdir.t. All files

tests/ignore_slash_in_subdir.t

new file mode 100644@@ -0,0 +1,19 @@+Setup:++  $ . $TESTDIR/setup.sh+  $ mkdir -p subdir/ignoredir+  $ mkdir ignoredir+  $ printf 'match1\n' > subdir/ignoredir/file1.txt+  $ printf 'match1\n' > ignoredir/file1.txt+  $ printf '/ignoredir\n' > subdir/.ignore++Ignore file in subdir/ignoredir, but not in ignoredir:++  $ ag match+  ignoredir/file1.txt:1:match1++From subdir, ignore file in subdir/ignoredir:++  $ cd subdir+  $ ag match+  [1]