Merge branch 'tf/doc-pt-br'
[gitweb.git] / diffcore-pickaxe.c
index 574b3e833711fe3794636b86dbf2b9d9deb5e151..d0ef8397008824fb5139680856e3229ecf2c4eb1 100644 (file)
@@ -25,10 +25,12 @@ static unsigned int contains(struct diff_filespec *one,
                regmatch_t regmatch;
                int flags = 0;
 
+               assert(data[sz] == '\0');
                while (*data && !regexec(regexp, data, 1, &regmatch, flags)) {
                        flags |= REG_NOTBOL;
-                       data += regmatch.rm_so;
-                       if (*data) data++;
+                       data += regmatch.rm_eo;
+                       if (*data && regmatch.rm_so == regmatch.rm_eo)
+                               data++;
                        cnt++;
                }