the_silver_searcher icon indicating copy to clipboard operation
the_silver_searcher copied to clipboard

--unrestricted, --all-text, etc cause --ignore to not be obeyed

Open ggreer opened this issue 11 years ago • 7 comments

Probably need to change the order in which those are parsed, or stick things in --ignore into hardcoded ignores. Thanks to @locks for reporting this.

ggreer avatar Aug 11 '13 02:08 ggreer

For what is worth here are the paremeters being passed by Chocolat:

12/08/13 14:09:58,002 com.chocolatapp.Chocolat.projectfind[1058]: [project find] <array: 0x7fb43c900760> { count = 19, capacity = 38, contents =
    0: <string: 0x7fb43c9008e0> { length = 9, contents = "--nocolor" }
    1: <string: 0x7fb43c900930> { length = 8, contents = "--column" }
    2: <string: 0x7fb43c900990> { length = 9, contents = "--nogroup" }
    3: <string: 0x7fb43c9009f0> { length = 9, contents = "--literal" }
    4: <string: 0x7fb43c900a50> { length = 13, contents = "--ignore-case" }
    5: <string: 0x7fb43c900ab0> { length = 10, contents = "--all-text" }
    6: <string: 0x7fb43c900b10> { length = 8, contents = "--ignore" }
    7: <string: 0x7fb43c900b70> { length = 3, contents = "tmp" }
    8: <string: 0x7fb43c900bd0> { length = 8, contents = "--ignore" }
    9: <string: 0x7fb43c900c30> { length = 3, contents = "log" }
    10: <string: 0x7fb43c900c90> { length = 8, contents = "--ignore" }
    11: <string: 0x7fb43c900cf0> { length = 8, contents = "coverage" }
    12: <string: 0x7fb43c900d50> { length = 8, contents = "--ignore" }
    13: <string: 0x7fb43c900db0> { length = 6, contents = "jquery" }
    14: <string: 0x7fb43c900e10> { length = 8, contents = "--ignore" }
    15: <string: 0x7fb43c900e70> { length = 3, contents = "doc" }
    16: <string: 0x7fb43c900ed0> { length = 8, contents = "--ignore" }
    17: <string: 0x7fb43c900f30> { length = 6, contents = "vendor" }
    18: <string: 0x7fb43c900f90> { length = 5, contents = "ember" }
}

ember being the actual term searched

locks avatar Aug 12 '13 13:08 locks

Ag is still showing results of the ignored archived folders.

2011
2012
2013
2014

Test command

ag --ignore "20*" 2011

ag still shows results of the archive.

How do I make ag a winner at finding relevant files?

John-Appleseed avatar Jul 12 '14 16:07 John-Appleseed

Is there a suggested workaround?

rosshadden avatar Mar 12 '15 18:03 rosshadden

I'm currently using this as a workaround:

ag -G '[^\.svn]' PATTERN

instead of something like:

ag -u --ignore=.svn PATTERN

I also thought of using specific .agignores files. Like building an alias:

# "ag ignore"
agi() {
  # find a way to read ignore pattern
  # put pattern in a temporary .agignore, see mktemp
  ag -p /path/to/.agignore "$@"
  # delete temp file
}

Not tested, just an idea.

seguri avatar Mar 31 '15 14:03 seguri

@seguri I'm not sure if your workaround is working as you expect. [^\.svn] would match anything that doesn't have a ., s, v, or n everywhere, which would mean everything would pass because even files with ., s, v, or n somewhere in their paths have other characters that are not in that character group.

rosshadden avatar Mar 31 '15 17:03 rosshadden

@rosshadden Yup you're right, that was just a (wrong) idea. I just used this one to test if -u and -G together are bugged or not:

ag -uG '^(?!.*\.svn).*$' PATTERN

seguri avatar Mar 31 '15 18:03 seguri

Any update on this?

ElSamhaa avatar Nov 27 '23 16:11 ElSamhaa