Merge branch 'ab/pcre-v2'
authorJunio C Hamano <gitster@pobox.com>
Sat, 24 Jun 2017 21:28:36 +0000 (14:28 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 24 Jun 2017 21:28:36 +0000 (14:28 -0700)
Hotfix for a topic already in 'master'.

* ab/pcre-v2:
grep: fix erroneously copy/pasted variable in check/assert pattern

1  2 
grep.c
diff --combined grep.c
index d7ef21358ea7f592dffff98884eb34169e097880,b197ad960c87bef3d0b800254e95a0922c90c693..06c4c249266acf5123c2de21a2a68b489e522ca5
--- 1/grep.c
--- 2/grep.c
+++ b/grep.c
@@@ -508,7 -508,7 +508,7 @@@ static void compile_pcre2_pattern(struc
                if (!p->pcre2_jit_stack)
                        die("Couldn't allocate PCRE2 JIT stack");
                p->pcre2_match_context = pcre2_match_context_create(NULL);
-               if (!p->pcre2_jit_stack)
+               if (!p->pcre2_match_context)
                        die("Couldn't allocate PCRE2 match context");
                pcre2_jit_stack_assign(p->pcre2_match_context, NULL, p->pcre2_jit_stack);
        } else if (p->pcre2_jit_on != 0) {
@@@ -1584,11 -1584,11 +1584,11 @@@ static int fill_textconv_grep(struct us
         */
        df = alloc_filespec(gs->path);
        switch (gs->type) {
 -      case GREP_SOURCE_SHA1:
 +      case GREP_SOURCE_OID:
                fill_filespec(df, gs->identifier, 1, 0100644);
                break;
        case GREP_SOURCE_FILE:
 -              fill_filespec(df, null_sha1, 0, 0100644);
 +              fill_filespec(df, &null_oid, 0, 0100644);
                break;
        default:
                die("BUG: attempt to textconv something without a path?");
@@@ -1928,8 -1928,9 +1928,8 @@@ void grep_source_init(struct grep_sourc
                 * If the identifier is non-NULL (in the submodule case) it
                 * will be a SHA1 that needs to be copied.
                 */
 -      case GREP_SOURCE_SHA1:
 -              gs->identifier = xmalloc(20);
 -              hashcpy(gs->identifier, identifier);
 +      case GREP_SOURCE_OID:
 +              gs->identifier = oiddup(identifier);
                break;
        case GREP_SOURCE_BUF:
                gs->identifier = NULL;
@@@ -1952,7 -1953,7 +1952,7 @@@ void grep_source_clear_data(struct grep
  {
        switch (gs->type) {
        case GREP_SOURCE_FILE:
 -      case GREP_SOURCE_SHA1:
 +      case GREP_SOURCE_OID:
        case GREP_SOURCE_SUBMODULE:
                free(gs->buf);
                gs->buf = NULL;
        }
  }
  
 -static int grep_source_load_sha1(struct grep_source *gs)
 +static int grep_source_load_oid(struct grep_source *gs)
  {
        enum object_type type;
  
        if (!gs->buf)
                return error(_("'%s': unable to read %s"),
                             gs->name,
 -                           sha1_to_hex(gs->identifier));
 +                           oid_to_hex(gs->identifier));
        return 0;
  }
  
@@@ -2021,8 -2022,8 +2021,8 @@@ static int grep_source_load(struct grep
        switch (gs->type) {
        case GREP_SOURCE_FILE:
                return grep_source_load_file(gs);
 -      case GREP_SOURCE_SHA1:
 -              return grep_source_load_sha1(gs);
 +      case GREP_SOURCE_OID:
 +              return grep_source_load_oid(gs);
        case GREP_SOURCE_BUF:
                return gs->buf ? 0 : -1;
        case GREP_SOURCE_SUBMODULE: