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

Pull remote refs into a git-pr namespace to allow for local caching #32

Open
davidwengier opened this issue Dec 12, 2018 · 0 comments
Open

Comments

@davidwengier
Copy link
Collaborator

That could work. I didn't bother with any kind of optimisation because I assumed git itself would be doing something similar when doing the fetch.

Thinking about what you said here, I think we could simplify things by taking advantage of what what a git fetch does. Instead of manually comparing local and remote refs, we could do a fetch and use the fetched refs at the definitive state. This would mean we would only ever hit the network once.

It would look something like this:

  1. Copy all remote pull and heads refs to our own local cache (I'm using refs/git-pr as the base so people would know which tool is creating the refs).
git fetch {remoteName} +refs/pull/*/merge:refs/git-pr/{remoteName}/pull/*/merge +refs/heads/*:refs/git-pr/{remoteName}/heads/* --prune
  1. Populate our ref dictionary using all of the refs under refs/git-pr/{remoteName}.

  2. Fix up our pull refs using the commit at HEAD^1 trick

Further down the line we could give the user the option to skip the fetch completely and simply use the cached refs (this would be useful on large/active repositories).

What do you think? What is the sun doing where you are? 😉

Originally posted by @jcansdale in #21 (comment)

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

No branches or pull requests

1 participant