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

Function gic_long_run

tests/test_gitignore_checked.c:703–741  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

701}
702
703static bool gic_long_run(const gic_long_input *input, bool parsing, size_t stop,
704 gic_observation *observation) {
705 cbm_ignore_checked_limits_t limits = gic_limits();
706 cbm_ignore_checked_t *owner = NULL;
707 const cbm_ignore_program_t *program = NULL;
708 bool ok = gic_open(&owner, &limits);
709 if (ok)
710 ok = parsing ? gic_parse(owner, "keep", 4, 1, &program)
711 : gic_parse(owner, input->patterns, input->pattern_length, 1, &program);
712 cbm_ignore_checked_usage_t before = {0}, after = {0};
713 ok = ok && cbm_ignore_checked_usage(owner, &before);
714 gic_counter counter = {.stop = stop};
715 cbm_ignore_checked_control_t control = gic_control();
716 control.cancelled = gic_cancel;
717 control.context = &counter;
718 cbm_ignore_checked_status_t status = CBM_IGNORE_CHECKED_INVALID;
719 const cbm_ignore_program_t *parsed = NULL;
720 if (ok)
721 ok = gic_long_operation(owner, program, input, parsing, &control, &parsed, &status);
722 ok = ok && cbm_ignore_checked_usage(owner, &after);
723 if (ok && status == CBM_IGNORE_CHECKED_OK)
724 ok = (!stop || counter.calls < stop) && after.terminal_status == CBM_IGNORE_CHECKED_OK;
725 else if (ok)
726 ok = status == CBM_IGNORE_CHECKED_CANCELLED && stop && counter.calls >= stop &&
727 gic_terminal(owner, program, CBM_IGNORE_CHECKED_CANCELLED);
728 observation->polls = counter.calls;
729 observation->work = after.work_used - before.work_used;
730 observation->cancelled = status == CBM_IGNORE_CHECKED_CANCELLED;
731 /* Necessary aggregate bound only. This does not observe individual gaps;
732 * the callback never reenters usage or any other owner operation. */
733 if (ok)
734 ok = counter.calls > 0 && counter.calls <= UINT64_MAX / 4096 &&
735 observation->work <= (uint64_t)counter.calls * 4096;
736 if (ok && parsing && status == CBM_IGNORE_CHECKED_OK)
737 ok = gic_match(owner, parsed, input->path, false, input->expected);
738 size_t polls_before_free = counter.calls;
739 cbm_ignore_checked_free(owner);
740 return ok && counter.calls == polls_before_free;
741}
742
743static bool gic_cancel_sweep(const gic_long_input *input, bool parsing) {
744 gic_observation normal = {0};

Callers 2

gic_cancel_sweepFunction · 0.85

Calls 9

gic_limitsFunction · 0.85
gic_openFunction · 0.85
gic_parseFunction · 0.85
cbm_ignore_checked_usageFunction · 0.85
gic_controlFunction · 0.85
gic_long_operationFunction · 0.85
gic_terminalFunction · 0.85
gic_matchFunction · 0.85
cbm_ignore_checked_freeFunction · 0.85

Tested by

no test coverage detected