Conversation
ttaylorr
approved these changes
Mar 24, 2017
| return &fakeCreds{list: make([]Creds, 0)} | ||
| } | ||
|
|
||
| type erroringCreds struct { |
| } | ||
| var sshResolver SSHResolver = &sshAuthClient{os: osEnv} | ||
|
|
||
| if gitEnv.Bool("lfs.cachecredentials", false) { |
Contributor
There was a problem hiding this comment.
Minor: this is missing an entry in git-lfs-config(5).ronn.
lfsapi/ssh.go
Outdated
| } | ||
|
|
||
| key := strings.Join([]string{e.SshUserAndHost, e.SshPort, e.SshPath, method}, "//") | ||
| if res, ok := c.endpoints[key]; ok && (res.ExpiresAt.IsZero() || res.ExpiresAt.After(time.Now().Add(5*time.Second))) { |
Contributor
There was a problem hiding this comment.
Minor: I think that:
resp.ExpiresAt.IsZero() || (time.Until(res.ExpiresAt) > 5*time.Second)is clearer.
ttaylorr
added a commit
that referenced
this pull request
Mar 28, 2017
ttaylorr
added a commit
that referenced
this pull request
Mar 28, 2017
Backport #2080 for v2.0.x: ssh auth and credential helper caching
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is another approach to #2045. It adds implementations of
lfsapi.CredentialHelperandlfsapi.SSHResolverthat cache the results in-memory to prevent multiple calls over the span of a singlegit lfscall. While this is the same idea as #2045, it's implemented by wrapping some go interfaces, instead of changinglfsapi.Clientcall signatures. This is more idiomatic go, and doesn't require any changes to callers.In the interest of testing this out for v2.0.2, the cachers are disabled until
git config lfs.cachecredentials 1is run.To highlight the difference, I hacked the batch size to just 1 to simulate multiple batches. Output has important lines in bold to show the difference.
HTTP REMOTE
Here's the uncached output for an HTTP remote
fetch:Here's the cached output:
Notice the
git credential cachecall here ^SSH REMOTE
Here's the uncached output for an SSH remote:
And the cached output:
Notice the
ssh cache:message ^