Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-repo: ensure external source gets updated if repo url changes #241

Merged
merged 4 commits into from
Sep 3, 2018

Conversation

eysi09
Copy link
Collaborator

@eysi09 eysi09 commented Aug 23, 2018

No description provided.

@eysi09 eysi09 force-pushed the multi-repos-hash-dirname branch from 09230f0 to bec01c0 Compare August 23, 2018 16:51
@eysi09 eysi09 changed the title Append a hash of repo url to remote sources Multi-repo: ensure external source gets updated if repo url changes Aug 23, 2018
}
},
}

function getUrlHash(url: string) {
return (parse(url).hash || "").split("#")[1]
function getGitUrlParts(url: string): { repositoryUrl: string, hash: string } {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't really matter here, but this type annotation can also just be inferred and not explicitly stated.

if (!isCloned) {
const entry = logEntry.info({ section: name, msg: `Fetching from ${url}`, entryStyle: EntryStyle.activity })
const { repositoryUrl, hash } = getGitUrlParts(url)
await git("clone", "--depth", "1", "--branch", hash, repositoryUrl, absPath)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the hash is an empty string here?

await git("remote", "update")

const remoteHash = (await git("ls-remote", repositoryUrl, hash)).split("\t")[0]
const localHash = (await git("show-ref", "--hash", hash)).split("\n")[0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here. Do we need to have a default hash/branch? Or would it make more sense to conditionally add these params?

@eysi09 eysi09 force-pushed the multi-repos-hash-dirname branch from bec01c0 to 323b6e9 Compare August 31, 2018 11:20
@eysi09
Copy link
Collaborator Author

eysi09 commented Aug 31, 2018

I've resolved the issues above.

@edvald edvald merged commit 6c776b0 into master Sep 3, 2018
@edvald edvald deleted the multi-repos-hash-dirname branch September 3, 2018 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants