<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -135,6 +135,7 @@ END
                             [ '--before-context', '-B', GetoptLong::REQUIRED_ARGUMENT ],
                             [ '--context', '-C', GetoptLong::OPTIONAL_ARGUMENT ],
                             [ '-g', GetoptLong::REQUIRED_ARGUMENT ],
+                            [ '-k', GetoptLong::REQUIRED_ARGUMENT ],
                             [ '-x', '--line-regexp', GetoptLong::NO_ARGUMENT ],
                             [ '-s', '--line-start', GetoptLong::NO_ARGUMENT ],
                             [ '-e', '--line-end', GetoptLong::NO_ARGUMENT ]
@@ -171,6 +172,7 @@ END
     opt[:before_context] = 0
     opt[:collect_context] = false
     opt[:filename_regex] = nil
+    opt[:neg_filename_regex] = nil
     
     # if redirected (RAK_TEST allows us to redirect in testing and still 
     # get the non-redirected defaults).
@@ -292,6 +294,8 @@ END
           opt[:after_context] = val
         when '-g'
           opt[:filename_regex] = arg
+        when '-k'
+          opt[:neg_filename_regex] = arg
         when '-x'
           opt[:match_whole_lines] = true
         when '-s'
@@ -453,6 +457,16 @@ END
       files = files.select {|fn| fn =~ fn_re }
     end
     
+    # filter based on -k=REGEX
+    if opt[:neg_filename_regex]
+      if $use_onig
+        fn_re = Oniguruma::ORegexp.new(opt[:neg_filename_regex])
+      else
+        fn_re = Regexp.new(opt[:neg_filename_regex])
+      end
+      files = files.reject {|fn| fn =~ fn_re }
+    end
+    
     # remove the &quot;./&quot;
     files.map! {|fn| fn[0..1] == &quot;./&quot; ? fn[2..-1] : fn}
     
@@ -763,7 +777,8 @@ File finding:
 
 File inclusion/exclusion:
   -n                    No descending into subdirectories
-  -g REGEX              Only search in file matching REGEX.
+  -g REGEX              Only search in files matching REGEX.
+  -k REGEX              Only search in files not matching REGEX.
   -a, --all             All files, regardless of extension (but still skips
                         blib, pkg, CVS, _darcs, .git, .pc, RCS, SCCS and .svn dirs)
   --ruby                Include only Ruby files.</diff>
      <filename>bin/rak</filename>
    </modified>
    <modified>
      <diff>@@ -454,6 +454,15 @@ END
 
   end
 
+  it &quot;-k REGEX only searches in files not matching REGEX&quot; do
+    asterize_ansi(%x{rak Pikon -k f.o}).should == t=&lt;&lt;END
+*dir1/bar.rb*
+   2|bar bar bar bar *Pikon* bar
+   9|bar bar *Pikon* bar bar bar
+
+END
+  end
+  
   it &quot;-x means match only whole lines&quot; do
     asterize_ansi(%x{rak Cap -x}).should == &quot;&quot;
     asterize_ansi(%x{rak &quot;(foo )+Cap\\w+( foo)+&quot; -x}).should == t=&lt;&lt;END</diff>
      <filename>spec/rak_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c4343ef796e18f32e94060b36643652e282ec45f</id>
    </parent>
  </parents>
  <author>
    <name>Daniel Lucraft</name>
    <email>dan@fluentradical.com</email>
  </author>
  <url>http://github.com/danlucraft/rak/commit/cd29cbb4025c46254ca73cb45008ff99e7feb9bc</url>
  <id>cd29cbb4025c46254ca73cb45008ff99e7feb9bc</id>
  <committed-date>2008-08-11T06:43:01-07:00</committed-date>
  <authored-date>2008-08-11T06:43:01-07:00</authored-date>
  <message>Committed Juozas Gaigalas' negative file matching patch.</message>
  <tree>5e8b488f979f958f7d660d934bc0f94d59d785da</tree>
  <committer>
    <name>Daniel Lucraft</name>
    <email>dan@fluentradical.com</email>
  </committer>
</commit>
