MCPcopy Index your code
hub / github.com/simstudioai/sim / resolveFileBranch

Function resolveFileBranch

apps/sim/connectors/azure-devops/azure-devops.ts:998–1016  ·  view source on GitHub ↗

* Resolves the branch to fetch a single repository file from in getDocument. Uses * the configured branch override when set, otherwise the repository's default * branch (resolved from the cached or freshly-listed repository record).

(
  accessToken: string,
  organization: string,
  project: string,
  repoId: string,
  branchOverride: string,
  syncContext?: Record<string, unknown>
)

Source from the content-addressed store, hash-verified

996 * branch (resolved from the cached or freshly-listed repository record).
997 */
998async function resolveFileBranch(
999 accessToken: string,
1000 organization: string,
1001 project: string,
1002 repoId: string,
1003 branchOverride: string,
1004 syncContext?: Record<string, unknown>
1005): Promise<{ branch: string; repo?: GitRepository }> {
1006 if (branchOverride) {
1007 const repos = (syncContext?.repositories as GitRepository[] | undefined) ?? []
1008 return { branch: branchOverride, repo: repos.find((r) => r.id === repoId) }
1009 }
1010 const repos =
1011 (syncContext?.repositories as GitRepository[] | undefined) ??
1012 (await listRepositories(accessToken, organization, project))
1013 if (syncContext && !syncContext.repositories) syncContext.repositories = repos
1014 const repo = repos.find((r) => r.id === repoId)
1015 return { branch: stripRefsHeads(repo?.defaultBranch ?? ''), repo }
1016}
1017
1018/**
1019 * Fetches and hydrates a single repository file by its externalId. Re-fetches the

Callers 1

getFileDocumentFunction · 0.85

Calls 2

listRepositoriesFunction · 0.85
stripRefsHeadsFunction · 0.85

Tested by

no test coverage detected