Skip to content

Commit

Permalink
refactor: Update dependencies and remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Jul 13, 2024
1 parent 96ba586 commit efabb20
Showing 1 changed file with 0 additions and 122 deletions.
122 changes: 0 additions & 122 deletions vcs/git_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package vcs

import (
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/config"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/go-git/go-git/v5/plumbing/transport"
"strings"
)
Expand Down Expand Up @@ -53,12 +51,6 @@ func WithPrivateKey(key string) GitOption {
}
}

func WithDefaultBranch(branch string) GitOption {
return func(c *GitClient) {
c.defaultBranch = branch
}
}

func WithDefaultInit(init bool) GitOption {
return func(c *GitClient) {
c.defaultInit = init
Expand All @@ -79,48 +71,6 @@ func WithURL(url string) GitCloneOption {
}
}

func WithAuthClone(auth transport.AuthMethod) GitCloneOption {
return func(o *git.CloneOptions) {
o.Auth = auth
}
}

func WithRemoteName(name string) GitCloneOption {
return func(o *git.CloneOptions) {
o.RemoteName = name
}
}

func WithSingleBranch(singleBranch bool) GitCloneOption {
return func(o *git.CloneOptions) {
o.SingleBranch = singleBranch
}
}

func WithNoCheckout(noCheckout bool) GitCloneOption {
return func(o *git.CloneOptions) {
o.NoCheckout = noCheckout
}
}

func WithDepthClone(depth int) GitCloneOption {
return func(o *git.CloneOptions) {
o.Depth = depth
}
}

func WithRecurseSubmodules(recurseSubmodules git.SubmoduleRescursivity) GitCloneOption {
return func(o *git.CloneOptions) {
o.RecurseSubmodules = recurseSubmodules
}
}

func WithTags(tags git.TagMode) GitCloneOption {
return func(o *git.CloneOptions) {
o.Tags = tags
}
}

type GitCheckoutOption func(o *git.CheckoutOptions)

func WithBranch(branch string) GitCheckoutOption {
Expand All @@ -145,30 +95,6 @@ func WithHash(hash string) GitCheckoutOption {

type GitCommitOption func(o *git.CommitOptions)

func WithAll(all bool) GitCommitOption {
return func(o *git.CommitOptions) {
o.All = all
}
}

func WithAuthor(author *object.Signature) GitCommitOption {
return func(o *git.CommitOptions) {
o.Author = author
}
}

func WithCommitter(committer *object.Signature) GitCommitOption {
return func(o *git.CommitOptions) {
o.Committer = committer
}
}

func WithParents(parents []plumbing.Hash) GitCommitOption {
return func(o *git.CommitOptions) {
o.Parents = parents
}
}

type GitPullOption func(o *git.PullOptions)

func WithRemoteNamePull(name string) GitPullOption {
Expand All @@ -183,12 +109,6 @@ func WithBranchNamePull(branch string) GitPullOption {
}
}

func WithDepthPull(depth int) GitPullOption {
return func(o *git.PullOptions) {
o.Depth = depth
}
}

func WithAuthPull(auth transport.AuthMethod) GitPullOption {
return func(o *git.PullOptions) {
if auth != nil {
Expand All @@ -197,58 +117,16 @@ func WithAuthPull(auth transport.AuthMethod) GitPullOption {
}
}

func WithRecurseSubmodulesPull(recurseSubmodules git.SubmoduleRescursivity) GitPullOption {
return func(o *git.PullOptions) {
o.RecurseSubmodules = recurseSubmodules
}
}

func WithForcePull(force bool) GitPullOption {
return func(o *git.PullOptions) {
o.Force = force
}
}

type GitPushOption func(o *git.PushOptions)

func WithRemoteNamePush(name string) GitPushOption {
return func(o *git.PushOptions) {
o.RemoteName = name
}
}

func WithRefSpecs(specs []config.RefSpec) GitPushOption {
return func(o *git.PushOptions) {
o.RefSpecs = specs
}
}

func WithAuthPush(auth transport.AuthMethod) GitPushOption {
return func(o *git.PushOptions) {
o.Auth = auth
}
}

func WithPrune(prune bool) GitPushOption {
return func(o *git.PushOptions) {
o.Prune = prune
}
}

func WithForcePush(force bool) GitPushOption {
return func(o *git.PushOptions) {
o.Force = force
}
}

type GitResetOption func(o *git.ResetOptions)

func WithCommit(commit plumbing.Hash) GitResetOption {
return func(o *git.ResetOptions) {
o.Commit = commit
}
}

func WithMode(mode git.ResetMode) GitResetOption {
return func(o *git.ResetOptions) {
o.Mode = mode
Expand Down

0 comments on commit efabb20

Please sign in to comment.