exclude: process exclude and include directives in order
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 30 Apr 2012 02:04:41 +0000 (19:04 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 30 Apr 2012 02:05:17 +0000 (19:05 -0700)
commit5194f0b8ed4dc1f4ef62099a3652b541202109d3
tree8866c98add979f32ec056d30d0d05b3f4ee6a8ff
parentf58a007d877819767440ee92d181fef6b0039706
exclude: process exclude and include directives in order

This restores the pre-2009 behavior, and is part of a fix of a
grep bug reported by Quentin Arce in
<http://lists.gnu.org/archive/html/bug-grep/2012-04/msg00056.html>.
* lib/exclude.c (struct exclude): Remove 'tail' member.
(new_exclude_segment): Prepend the new segment instead of appending.
Return void, since that's now more convenient.
(file_pattern_matches): Renamed from excluded_file_pattern_p.
(file_name_matches): Renamed from excluded_file_name_p.
(file_pattern_matches, file_name_matches):
Return true if the pattern matches, not if it excludes.
All callers changed.
(excluded_file_name): Process the list in reverse order;
since the list is now reversed this restores the pre-2009 behavior.
(add_exclude): Adjust to new reversed-order list.  Use local var
rather than macro, for clarity.
* tests/test-exclude7.sh: Adjust to corrected behavior.
ChangeLog
lib/exclude.c
tests/test-exclude7.sh