feat: add Cred feature with recipe pattern and replace Credential DTO in remote options#195
Open
feat: add Cred feature with recipe pattern and replace Credential DTO in remote options#195
Conversation
TODO: Credential struct is a flat DTO mixing all credential fields regardless of type. Consider replacing it with a builder pattern where callers construct Cred directly via factory methods (Cred.default(), Cred.sshKeyFromAgent(), etc.) and inject it into fetch/push options — eliminating the Credential struct entirely.
|
@racgoo is attempting to deploy a commit to the Toss Team on Vercel. A member of the Team first needs to authorize it. |
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.
credfeature in #94@seokju-na I wasn't assigned to this issue yet, but I wanted to give it a try. Please let me know if the approach looks good or if anything needs to be changed.
Summary
Credclass with factory methods (default(),sshKeyFromAgent(),sshKey(),sshKeyFromMemory(),userpassPlaintext(),username(),credentialHelper()) andCredTypeenum.git2::Creddoes not implementCloneorSend, so it cannot be reused across callbacks or moved into async tasks. Instead,Credstores only the parameters needed to build agit2::Cred(recipe pattern). A freshgit2::Credis created from the recipe each time it is needed, makingCredfreely cloneable and safe to send across threads.CredentialDTO andCredentialTypeenum fromremote.rs.FetchOptions,PushOptions, andPruneOptionsnow takeCreddirectly in theircredentialfield.Credentialwas a flat object that held all possible fields at once (e.g.privateKeyPathwas present even for a plain username/password credential), which made it unclear which fields were actually required for each credential type.Creddirectly. Errors only surface when the credential is actually used (e.g. during network I/O orhasUsername()).Breaking changes
FetchOptions.credential: Credential | nullFetchOptions.credential: Cred | nullPushOptions.credential: Credential | nullPushOptions.credential: Cred | null