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

Function sh_pass_file

src/pipeline/pass_shell.c:3921–3947  ·  view source on GitHub ↗

One script, Makefile or CI configuration `rel` (on disk at `path`). */

Source from the content-addressed store, hash-verified

3919
3920/* One script, Makefile or CI configuration `rel` (on disk at `path`). */
3921static void sh_pass_file(sh_pass_t *p, cbm_pipeline_ctx_t *ctx, CBMHashTable *prow, const char *rel,
3922 const char *path, CBMLanguage lang) {
3923 bool ci = cbm_ci_path(rel) || (prow && cbm_ht_get(prow, rel));
3924 if (lang != CBM_LANG_BASH && lang != CBM_LANG_MAKEFILE && !ci) {
3925 return;
3926 }
3927 size_t len = 0;
3928 char *src = sh_read(path, &len);
3929 if (!src) {
3930 return;
3931 }
3932 if (!p->ix_ready) {
3933 p->ix_ready = true;
3934 p->ix_ok = sh_index_build(p->ix, ctx);
3935 p->parser = ts_parser_new();
3936 }
3937 if (p->ix_ok && p->parser) {
3938 if (ci) {
3939 sh_ci_file(p, rel, src, len);
3940 } else if (lang == CBM_LANG_BASH) {
3941 sh_script(p, rel, src, len);
3942 } else {
3943 sh_makefile(p, rel, src, len);
3944 }
3945 }
3946 cbm_free(CBM_MEM_CLASS_OTHER, src);
3947}
3948
3949/* Mark the File node of each file running a container build
3950 * {"declares_build":true} -- resolved or not: an incremental run reads these

Callers 1

cbm_pipeline_pass_shellFunction · 0.85

Calls 8

cbm_ci_pathFunction · 0.85
cbm_ht_getFunction · 0.85
sh_readFunction · 0.85
sh_index_buildFunction · 0.85
sh_ci_fileFunction · 0.85
sh_scriptFunction · 0.85
sh_makefileFunction · 0.85
cbm_freeFunction · 0.85

Tested by

no test coverage detected