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

Already on GitHub? Sign in to your account

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

Open
ggreer opened this Issue Aug 11, 2013 · 6 comments

Comments

Projects
None yet
5 participants
Owner

ggreer commented Aug 11, 2013

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.

locks commented Aug 12, 2013

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

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?

Is there a suggested workaround?

seguri commented Mar 31, 2015

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

seguri commented Mar 31, 2015

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment