1. 22 5月, 2006 1 次提交
  2. 18 5月, 2006 2 次提交
    • L
      builtin-grep: workaround for non GNU grep. · bbb66c60
      Linus Torvalds 提交于
      Of course, it still ignores the fact that not all grep's support some of
      the flags like -F/-L/-A/-C etc, but for those cases, the external grep
      itself will happily just say "unrecognized option -F" or similar.
      
      So with this change, "git grep" should handle all the flags the native
      grep handles, which is really quite fine. We don't _need_ to expose
      anything more, and if you do want our extensions, you can get them with
      "--uncached" and an up-to-date index.
      
      No configuration necessary, and we automatically take advantage of any
      native grep we have, if possible.
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      bbb66c60
    • J
      Revert "builtin-grep: workaround for non GNU grep." · e78503db
      Junio C Hamano 提交于
      This reverts 518920b7 commit.
      Linus has a more portable alternative.
      e78503db
  3. 17 5月, 2006 1 次提交
    • J
      builtin-grep: workaround for non GNU grep. · 518920b7
      Junio C Hamano 提交于
      Some implementations do not know what to do with -H; define
      NO_H_OPTION_IN_GREP when you build git if your grep lacks -H.
      
      Most of the time, it can be worked around by prepending
      /dev/null to the argument list, but that causes -L and -c to
      slightly misbehave (they both expose /dev/null is given), so
      when these options are given, do not run external grep that does
      not understand -H.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      518920b7
  4. 16 5月, 2006 2 次提交
  5. 15 5月, 2006 1 次提交
    • L
      builtin-grep: use external grep when we can take advantage of it · 1e2398d7
      Linus Torvalds 提交于
      It's not perfect, but it gets the "git grep some-random-string" down to
      the good old half-a-second range for the kernel.
      
      It should convert more of the argument flags for "grep", that should be
      trivial to expand (I did a few just as an example). It should also bother
      to try to return the right "hit" value (which it doesn't, right now - the
      code is kind of there, but I didn't actually bother to do it _right_).
      
      Also, right now it _just_ limits by number of arguments, but it should
      also strictly speaking limit by total argument size (ie add up the length
      of the filenames, and do the "exec_grep()" flush call if it's bigger than
      some random value like 32kB).
      
      But I think that it's _conceptually_ doing all the right things, and it
      seems to work. So maybe somebody else can do some of the final polish.
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      1e2398d7
  6. 10 5月, 2006 3 次提交
  7. 09 5月, 2006 2 次提交
    • J
      builtin-grep: tighten argument parsing. · 5acd64ed
      Junio C Hamano 提交于
      I mistyped
      
      	git grep next -e '"^@"' '*.c'
      
      and got many hits that contain "next" without complaint.
      Obviously what I meant to say was:
      
      	git grep -e '"^@"' next -- '*.c'
      
      This tightens the argument parsing rule a bit:
      
       - All "grep" parameters should come first;
      
       - If there is no -e nor -f to specify pattern, the first non
         option string is the parameter;
      
       - After that, zero or more revs can follow.
      
       - An optional '--' can be present, and is skipped.
      
       - All the rest are pathspecs.  If '--' was not there, they must
         be paths that exist in the working tree.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      5acd64ed
    • J
      Teach -f <file> option to builtin-grep. · aa8c79ad
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      aa8c79ad
  8. 04 5月, 2006 3 次提交
  9. 03 5月, 2006 5 次提交
  10. 02 5月, 2006 4 次提交
  11. 01 5月, 2006 1 次提交
    • J
      built-in "git grep" · 5010cb5f
      Junio C Hamano 提交于
      This attempts to set up built-in "git grep" to further reduce
      our dependence on the shell, while at the same time optionally
      allowing to run grep against object database.  You could do
      funky things like these:
      
      	git grep --cached -e pattern	;# grep from index
      	git grep -e pattern master	;# or in a rev
      	git grep -e pattern master next ;# or in multiple revs
      	git grep -e pattern pu^@	;# even like this with an
      					;# extension from another topic ;-)
      	git grep -e pattern master..next ;# or even from rev ranges
      	git grep -e pattern master~20:Documentation
      					;# or an arbitrary tree
      	git grep -e pattern next:git-commit.sh
              				;# or an arbitrary blob
      
      Right now, it does not understand and/or obey many options grep
      should accept, and the pattern must be given with -e option due
      to the way the parameter parser is structured, both of which
      obviously need to be fixed for usability.
      
      But this is going in the right direction.  The shell script
      version is one of the worst Portability offender in the git
      barebone Porcelainish; it uses xargs -0 to pass paths around and
      shell arrays to sift flags and parameters.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      5010cb5f