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

Function sh_unique_file

src/pipeline/pass_shell.c:1777–1791  ·  view source on GitHub ↗

The one candidate of `path` that names a File of the repository (its * File node in *id); NULL: none, or two. */

Source from the content-addressed store, hash-verified

1775/* The one candidate of `path` that names a File of the repository (its
1776 * File node in *id); NULL: none, or two. */
1777static const char *sh_unique_file(sh_t *s, const char *path, int64_t *id) {
1778 const char *c[PAIR_LEN] = {NULL, NULL};
1779 int n = sh_candidates(s, path, c);
1780 const char *hit = NULL;
1781 int found = 0;
1782 for (int i = 0; i < n; i++) {
1783 int64_t f = sh_repo_file_id(s, c[i]);
1784 if (f > 0) {
1785 found++;
1786 *id = f;
1787 hit = c[i];
1788 }
1789 }
1790 return found == SKIP_ONE ? hit : NULL;
1791}
1792
1793/* The program is a script of the repository -- its path names a file of it,
1794 * or a shell runs one (bash [-opts] FILE; -c TEXT is no file) -- resolved to

Callers 3

sh_spawn_scriptFunction · 0.85
sh_makeFunction · 0.85
sh_buildFunction · 0.85

Calls 2

sh_candidatesFunction · 0.85
sh_repo_file_idFunction · 0.85

Tested by

no test coverage detected