]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Tue, 28 Apr 2009 07:46:39 +0000 (00:46 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 28 Apr 2009 07:46:39 +0000 (00:46 -0700)
* maint:
  grep: fix segfault when "git grep '('" is given
  Documentation: fix a grammatical error in api-builtin.txt
  builtin-merge: fix a typo in an error message

1  2 
builtin-merge.c
grep.c

diff --cc builtin-merge.c
Simple merge
diff --cc grep.c
index f3a27d7d6e141bd8813b978edbe33d16aa764fb4,b0d992a6e0a838d0fb4e71e3a8bebe8266ed1070..04c777a20c1a8c10417cc9d44e53e5b99dc32a27
--- 1/grep.c
--- 2/grep.c
+++ b/grep.c
@@@ -366,23 -380,31 +368,25 @@@ static int match_one_pattern(struct gre
        return hit;
  }
  
 -static int match_expr_eval(struct grep_opt *o,
 -                         struct grep_expr *x,
 -                         char *bol, char *eol,
 -                         enum grep_context ctx,
 -                         int collect_hits)
 +static int match_expr_eval(struct grep_expr *x, char *bol, char *eol,
 +                         enum grep_context ctx, int collect_hits)
  {
        int h = 0;
 +      regmatch_t match;
  
+       if (!x)
+               die("Not a valid grep expression");
        switch (x->node) {
        case GREP_NODE_ATOM:
 -              h = match_one_pattern(o, x->u.atom, bol, eol, ctx);
 +              h = match_one_pattern(x->u.atom, bol, eol, ctx, &match, 0);
                break;
        case GREP_NODE_NOT:
 -              h = !match_expr_eval(o, x->u.unary, bol, eol, ctx, 0);
 +              h = !match_expr_eval(x->u.unary, bol, eol, ctx, 0);
                break;
        case GREP_NODE_AND:
 -              if (!collect_hits)
 -                      return (match_expr_eval(o, x->u.binary.left,
 -                                              bol, eol, ctx, 0) &&
 -                              match_expr_eval(o, x->u.binary.right,
 -                                              bol, eol, ctx, 0));
 -              h = match_expr_eval(o, x->u.binary.left, bol, eol, ctx, 0);
 -              h &= match_expr_eval(o, x->u.binary.right, bol, eol, ctx, 0);
 +              if (!match_expr_eval(x->u.binary.left, bol, eol, ctx, 0))
 +                      return 0;
 +              h = match_expr_eval(x->u.binary.right, bol, eol, ctx, 0);
                break;
        case GREP_NODE_OR:
                if (!collect_hits)