| 565 | } |
| 566 | |
| 567 | static bool gic_attempt_case(bool earlier) { |
| 568 | char pattern[96], path[64]; |
| 569 | size_t n = 0; |
| 570 | if (earlier) { |
| 571 | memcpy(pattern, "*\n!", 3); |
| 572 | n = 3; |
| 573 | } |
| 574 | for (size_t i = 0; i < 20; i++) { |
| 575 | memcpy(pattern + n, "a**", 3); |
| 576 | n += 3; |
| 577 | } |
| 578 | pattern[n++] = 'X'; |
| 579 | pattern[n] = 0; |
| 580 | memset(path, 'a', sizeof(path) - 1); |
| 581 | path[sizeof(path) - 1] = 0; |
| 582 | cbm_gitignore_t *legacy = cbm_gitignore_parse(pattern); |
| 583 | if (!legacy) |
| 584 | return false; |
| 585 | int old = cbm_gitignore_match_result(legacy, path, false); |
| 586 | cbm_gitignore_free(legacy); |
| 587 | if (old != (earlier ? 1 : 0)) |
| 588 | return false; |
| 589 | cbm_ignore_checked_t *owner = NULL; |
| 590 | const cbm_ignore_program_t *program = NULL; |
| 591 | cbm_ignore_checked_limits_t limits = gic_limits(); |
| 592 | bool ok = gic_open(&owner, &limits) && |
| 593 | gic_parse(owner, pattern, n, earlier ? 2 : 1, &program) && |
| 594 | gic_match_limit(owner, program, path, CBM_IGNORE_CAP_ATTEMPT); |
| 595 | cbm_ignore_checked_free(owner); |
| 596 | return ok; |
| 597 | } |
| 598 | |
| 599 | static bool gic_max_depth_boundary(void) { |
| 600 | char pattern[2 * CBM_IGNORE_CHECKED_DEPTH_MAX + 1]; |
no test coverage detected