MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / getCommitShaForRef

Function getCommitShaForRef

Support/SingleFileLibs/javascript/app.js:185–192  ·  view source on GitHub ↗
(ref)

Source from the content-addressed store, hash-verified

183
184 const commitShaCache = new Map(); // ref -> sha
185 async function getCommitShaForRef(ref) {
186 if (commitShaCache.has(ref)) return commitShaCache.get(ref);
187 // Works for branch or tag or SHA itself
188 // GET /commits/{ref}
189 const data = await fetchJSON(`https://api.github.com/repos/${OWNER}/${REPO}/commits/${encodeURIComponent(ref)}`);
190 commitShaCache.set(ref, data.sha);
191 return data.sha;
192 }
193
194 async function getRepoTree(ref) {
195 // Use trees API for a single call listing all files

Callers 3

getRepoTreeFunction · 0.85
getVersionStringFunction · 0.85
updateVersionInfoFunction · 0.85

Calls 3

fetchJSONFunction · 0.85
setMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected