In-memory implementation of ls-remote using go-git to reduce repo lock contention#574
Merged
jessesuen merged 1 commit intoargoproj:masterfrom Sep 11, 2018
Merged
Conversation
6 tasks
merenbach
approved these changes
Sep 11, 2018
Contributor
merenbach
left a comment
There was a problem hiding this comment.
@jessesuen looks great! Only a minor concern regarding log message string formatting, and it's more a matter of style.
| //log.Debugf("%s\t%s", hash, refName) | ||
| if ref.Name().Short() == revision { | ||
| if ref.Type() == plumbing.HashReference { | ||
| log.Debugf("revision '%s' resolved to '%s'", revision, hash) |
Contributor
There was a problem hiding this comment.
Minor: Suggest using the %q formatter to quote items, if it is clear enough, without needing embedded quotation marks such as '%s'.
Member
Author
There was a problem hiding this comment.
@merenbach I actually prefer our messages to use single quotes instead of double quotes, which is why I use '%s' and not %q.
Contributor
There was a problem hiding this comment.
Thanks, @jessesuen! Have opened #579 to help us ensure we're on the same page moving forward, since I've been using %q and should change to conform.
| // If refToResolve is non-empty, we are resolving symbolic reference (e.g. HEAD). | ||
| // It should exist in our refToHash map | ||
| if hash, ok := refToHash[refToResolve]; ok { | ||
| log.Debugf("symbolic reference '%s' (%s) resolved to '%s'", revision, refToResolve, hash) |
| } | ||
| // We support the ability to use a truncated commit-SHA (e.g. first 7 characters of a SHA) | ||
| if IsTruncatedCommitSHA(revision) { | ||
| log.Debugf("revision '%s' assumed to be commit sha", revision) |
| return strings.Fields(out)[0], nil | ||
| // If we get here, revision string had non hexadecimal characters (indicating its a branch, tag, | ||
| // or symbolic ref) and we were unable to resolve it to a commit SHA. | ||
| return "", fmt.Errorf("Unable to resolve '%s' to a commit SHA", revision) |
alexmt
approved these changes
Sep 11, 2018
leoluz
added a commit
to leoluz/argo-cd
that referenced
this pull request
Mar 13, 2025
* fix: handle nil ParseableType from GVKParser Signed-off-by: Leonardo Luz Almeida <leoluz@users.noreply.github.com> * address review comments Signed-off-by: Leonardo Luz Almeida <leoluz@users.noreply.github.com> --------- Signed-off-by: Leonardo Luz Almeida <leoluz@users.noreply.github.com>
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.
Partially addresses #554.
This introduces go-git package to perform some of the git client functionality, namely
ls-remote. It reduces repo-server lock contention by allowing thels-remoterequest to happen concurrently, and without having the global lock on a repo, and without needing to clone the repo.