MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / gic_attempt_case

Function gic_attempt_case

tests/test_gitignore_checked.c:567–597  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

565}
566
567static 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
599static bool gic_max_depth_boundary(void) {
600 char pattern[2 * CBM_IGNORE_CHECKED_DEPTH_MAX + 1];

Callers 1

Calls 8

cbm_gitignore_parseFunction · 0.85
cbm_gitignore_freeFunction · 0.85
gic_limitsFunction · 0.85
gic_openFunction · 0.85
gic_parseFunction · 0.85
gic_match_limitFunction · 0.85
cbm_ignore_checked_freeFunction · 0.85

Tested by

no test coverage detected