MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / getRepoPath

Function getRepoPath

packages/shared/src/utils.ts:105–122  ·  view source on GitHub ↗
(repo: Repo)

Source from the content-addressed store, hash-verified

103}
104
105export const getRepoPath = (repo: Repo): { path: string, isReadOnly: boolean } => {
106 // If we are dealing with a local repository, then use that as the path.
107 // Mark as read-only since we aren't guaranteed to have write access to the local filesystem.
108 const cloneUrl = new URL(repo.cloneUrl);
109 if (repo.external_codeHostType === 'genericGitHost' && cloneUrl.protocol === 'file:') {
110 return {
111 path: cloneUrl.pathname,
112 isReadOnly: true,
113 }
114 }
115
116 const reposPath = path.join(env.DATA_CACHE_DIR, 'repos');
117
118 return {
119 path: path.join(reposPath, repo.id.toString()),
120 isReadOnly: false,
121 }
122}
123
124export const isCredentialsLoginEnabled = (org: Org): boolean => {
125 if (env.AUTH_CREDENTIALS_LOGIN_ENABLED !== undefined) {

Callers 14

indexRepositoryMethod · 0.90
cleanupRepositoryMethod · 0.90
onJobCompletedMethod · 0.90
indexGitRepositoryFunction · 0.90
getFileSourceForRepoFunction · 0.90
getFilesFunction · 0.90
getFileBlameFunction · 0.90
getDiffFunction · 0.90
listCommitsFunction · 0.90
getFolderContentsFunction · 0.90
getTreeFunction · 0.90
getCommitFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected