Skip to content

Commit

Permalink
add comment for lix uri parsing
Browse files Browse the repository at this point in the history
Summary:

Test Plan:
  • Loading branch information
janfjohannes committed Mar 28, 2024
1 parent 5433a2a commit 3337b51
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions lix/packages/client/src/openRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ export async function openRepository(
}
}

// Ignoring parsing errror and just using what we can get from the url, as we support also some edge cases for local repos that are not 100% clear yet
// see line 90 for explanation of lix uri parts
const { protocol, lixHost, repoHost, owner, repoName, username, password, namespace } =
parseLixUri(url)
if (debug && (username || password)) {
Expand All @@ -134,7 +136,7 @@ export async function openRepository(
)
}

// console.log({ namespace, protocol, lixHost, repoHost, owner, repoName, username, password })
// console.log({ namespace, protocol, lixHost, repoHost, owner, repoName, username, password, error })

const isWhitelistedRepo = whitelistedExperimentalRepos.includes(
`${owner}/${repoName}`.toLocaleLowerCase()
Expand Down Expand Up @@ -191,7 +193,9 @@ export async function openRepository(
const gitUrl = repoName ? `https://${repoHost}/${owner}/${repoName}` : ""

if (!gitUrl && debug) {
console.warn("valid repo url / local repo not found, only fs features available outside of repo")
console.warn(
"valid repo url / local repo not found, only fs features available outside of repo"
)
}

const expFeatures = Object.entries(experimentalFeatures) // eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down Expand Up @@ -651,7 +655,9 @@ export async function openRepository(

async forkStatus() {
if (!gitUrl) {
throw new Error("Could not find repo url, only github supported for forkStatus at the moment")
throw new Error(
"Could not find repo url, only github supported for forkStatus at the moment"
)
}
// uncomment to disable: return { ahead: 0, behind: 0, conflicts: false }
const repo = await this
Expand Down Expand Up @@ -951,7 +957,9 @@ export async function openRepository(

async mergeUpstream(cmdArgs) {
if (!gitUrl) {
throw new Error("Could not find repo url, only github supported for mergeUpstream at the moment")
throw new Error(
"Could not find repo url, only github supported for mergeUpstream at the moment"
)
}
const branch =
cmdArgs?.branch ||
Expand Down Expand Up @@ -1030,7 +1038,9 @@ export async function openRepository(

async getBranches() {
if (!gitUrl) {
throw new Error("Could not find repo url, only github supported for getBranches at the moment")
throw new Error(
"Could not find repo url, only github supported for getBranches at the moment"
)
}
const serverRefs = await isoGit
.listServerRefs({
Expand Down

0 comments on commit 3337b51

Please sign in to comment.