Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ func (r *Repository) parsePrettyFormatLogToList(ctx context.Context, logs []byte
type InitOptions struct {
// Indicates whether the repository should be initialized in bare format.
Bare bool
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -111,7 +110,6 @@ type CloneOptions struct {
Branch string
// The number of revisions to clone.
Depth uint64
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -155,7 +153,6 @@ func Clone(ctx context.Context, url, dst string, opts ...CloneOptions) error {
type FetchOptions struct {
// Indicates whether to prune during fetching.
Prune bool
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -188,7 +185,6 @@ type PullOptions struct {
Remote string
// The branch to pull updates from when All=false and Remote is supplied.
Branch string
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -222,7 +218,8 @@ func (r *Repository) Pull(ctx context.Context, opts ...PullOptions) error {
//
// Docs: https://git-scm.com/docs/git-push
type PushOptions struct {
// The additional options to be passed to the underlying git.
// Indicates whether to set upstream tracking for the branch.
SetUpstream bool
CommandOptions
}

Expand All @@ -233,7 +230,11 @@ func (r *Repository) Push(ctx context.Context, remote, branch string, opts ...Pu
opt = opts[0]
}

args := []string{"push", "--end-of-options", remote, branch}
args := []string{"push"}
if opt.SetUpstream {
args = append(args, "-u")
}
args = append(args, "--end-of-options", remote, branch)
_, err := exec(ctx, r.path, args, opt.Envs)
return err
}
Expand All @@ -244,7 +245,6 @@ func (r *Repository) Push(ctx context.Context, remote, branch string, opts ...Pu
type CheckoutOptions struct {
// The base branch if checks out to a new branch.
BaseBranch string
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -272,7 +272,6 @@ func (r *Repository) Checkout(ctx context.Context, branch string, opts ...Checko
type ResetOptions struct {
// Indicates whether to perform a hard reset.
Hard bool
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand All @@ -298,7 +297,6 @@ func (r *Repository) Reset(ctx context.Context, rev string, opts ...ResetOptions
//
// Docs: https://git-scm.com/docs/git-mv
type MoveOptions struct {
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand All @@ -323,7 +321,6 @@ type AddOptions struct {
All bool
// The specific pathspecs to be added to index.
Pathspecs []string
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -352,7 +349,6 @@ func (r *Repository) Add(ctx context.Context, opts ...AddOptions) error {
type CommitOptions struct {
// Author is the author of the changes if that's not the same as committer.
Author *Signature
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -395,7 +391,6 @@ type NameStatus struct {
//
// Docs: https://git-scm.com/docs/git-show#Documentation/git-show.txt---name-status
type ShowNameStatusOptions struct {
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -445,7 +440,6 @@ func (r *Repository) ShowNameStatus(ctx context.Context, rev string, opts ...Sho
//
// Docs: https://git-scm.com/docs/git-rev-parse
type RevParseOptions struct {
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -485,7 +479,6 @@ type CountObject struct {
//
// Docs: https://git-scm.com/docs/git-count-objects
type CountObjectsOptions struct {
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -537,7 +530,6 @@ func (r *Repository) CountObjects(ctx context.Context, opts ...CountObjectsOptio
//
// Docs: https://git-scm.com/docs/git-fsck
type FsckOptions struct {
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down
1 change: 0 additions & 1 deletion repo_blame.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
// BlameOptions contains optional arguments for blaming a file.
// Docs: https://git-scm.com/docs/git-blame
type BlameOptions struct {
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down
1 change: 0 additions & 1 deletion repo_blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import "context"
//
// Docs: https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt
type CatFileBlobOptions struct {
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down
11 changes: 0 additions & 11 deletions repo_commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ loop:
//
// Docs: https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt-lttypegt
type CatFileCommitOptions struct {
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -111,7 +110,6 @@ func (r *Repository) CatFileCommit(ctx context.Context, rev string, opts ...CatF
//
// Docs: https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt--t
type CatFileTypeOptions struct {
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -159,7 +157,6 @@ type LogOptions struct {
RegexpIgnoreCase bool
// The relative path of the repository.
Path string
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -217,7 +214,6 @@ func (r *Repository) Log(ctx context.Context, rev string, opts ...LogOptions) ([
type CommitByRevisionOptions struct {
// The relative path of the repository.
Path string
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -251,7 +247,6 @@ func (r *Repository) CommitByRevision(ctx context.Context, rev string, opts ...C
type CommitsByPageOptions struct {
// The relative path of the repository.
Path string
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -279,7 +274,6 @@ type SearchCommitsOptions struct {
MaxCount int
// The relative path of the repository.
Path string
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -307,7 +301,6 @@ func (r *Repository) SearchCommits(ctx context.Context, rev, pattern string, opt
type CommitsSinceOptions struct {
// The relative path of the repository.
Path string
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand All @@ -334,7 +327,6 @@ type DiffNameOnlyOptions struct {
NeedsMergeBase bool
// The relative path of the repository.
Path string
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -380,7 +372,6 @@ func (r *Repository) DiffNameOnly(ctx context.Context, base, head string, opts .
type RevListCountOptions struct {
// The relative path of the repository.
Path string
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -417,7 +408,6 @@ func (r *Repository) RevListCount(ctx context.Context, refspecs []string, opts .
type RevListOptions struct {
// The relative path of the repository.
Path string
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -452,7 +442,6 @@ func (r *Repository) RevList(ctx context.Context, refspecs []string, opts ...Rev
type LatestCommitTimeOptions struct {
// To get the latest commit time of the branch. When not set, it checks all branches.
Branch string
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down
3 changes: 0 additions & 3 deletions repo_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ type DiffOptions struct {
// The commit ID to used for computing diff between a range of commits (base,
// revision]. When not set, only computes diff for a single commit at revision.
Base string
// The additional options to be passed to the underlying Git.
CommandOptions
}

Expand Down Expand Up @@ -71,7 +70,6 @@ const (
//
// Docs: https://git-scm.com/docs/git-format-patch
type RawDiffOptions struct {
// The additional options to be passed to the underlying Git.
CommandOptions
}

Expand Down Expand Up @@ -122,7 +120,6 @@ func (r *Repository) RawDiff(ctx context.Context, rev string, diffType RawDiffFo

// DiffBinaryOptions contains optional arguments for producing binary patch.
type DiffBinaryOptions struct {
// The additional options to be passed to the underlying Git.
CommandOptions
}

Expand Down
1 change: 0 additions & 1 deletion repo_grep.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ type GrepOptions struct {
WordRegexp bool
// Whether use extended regular expressions.
ExtendedRegexp bool
// The additional options to be passed to the underlying Git.
CommandOptions
}

Expand Down
1 change: 0 additions & 1 deletion repo_pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
//
// Docs: https://git-scm.com/docs/git-merge-base
type MergeBaseOptions struct {
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down
4 changes: 0 additions & 4 deletions repo_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ type Reference struct {
//
// Docs: https://git-scm.com/docs/git-show-ref#Documentation/git-show-ref.txt---verify
type ShowRefVerifyOptions struct {
// The additional options to be passed to the underlying Git.
CommandOptions
}

Expand Down Expand Up @@ -96,7 +95,6 @@ type SymbolicRefOptions struct {
// The name of the reference, e.g. "refs/heads/master". When set, it will be
// used to update the symbolic ref.
Ref string
// The additional options to be passed to the underlying Git.
CommandOptions
}

Expand Down Expand Up @@ -135,7 +133,6 @@ type ShowRefOptions struct {
Tags bool
// The list of patterns to filter results.
Patterns []string
// The additional options to be passed to the underlying Git.
CommandOptions
}

Expand Down Expand Up @@ -198,7 +195,6 @@ func (r *Repository) Branches(ctx context.Context) ([]string, error) {
type DeleteBranchOptions struct {
// Indicates whether to force delete the branch.
Force bool
// The additional options to be passed to the underlying Git.
CommandOptions
}

Expand Down
8 changes: 0 additions & 8 deletions repo_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ type LsRemoteOptions struct {
Refs bool
// The list of patterns to filter results.
Patterns []string
// The additional options to be passed to the underlying Git.
CommandOptions
}

Expand Down Expand Up @@ -84,7 +83,6 @@ type RemoteAddOptions struct {
Fetch bool
// Indicates whether to add remote as mirror with --mirror=fetch.
MirrorFetch bool
// The additional options to be passed to the underlying Git.
CommandOptions
}

Expand Down Expand Up @@ -113,7 +111,6 @@ func (r *Repository) RemoteAdd(ctx context.Context, name, url string, opts ...Re
//
// Docs: https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-emremoveem
type RemoteRemoveOptions struct {
// The additional options to be passed to the underlying Git.
CommandOptions
}

Expand All @@ -140,7 +137,6 @@ func (r *Repository) RemoteRemove(ctx context.Context, name string, opts ...Remo
// /
// Docs: https://git-scm.com/docs/git-remote#_commands
type RemotesOptions struct {
// The additional options to be passed to the underlying Git.
CommandOptions
}

Expand Down Expand Up @@ -170,7 +166,6 @@ type RemoteGetURLOptions struct {
// Indicates whether to get all URLs, including lists that are not part of main
// URLs. This option is independent of the Push option.
All bool
// The additional options to be passed to the underlying Git.
CommandOptions
}

Expand Down Expand Up @@ -206,7 +201,6 @@ type RemoteSetURLOptions struct {
Push bool
// The regex to match existing URLs to replace (instead of first).
Regex string
// The additional options to be passed to the underlying Git.
CommandOptions
}

Expand Down Expand Up @@ -246,7 +240,6 @@ func (r *Repository) RemoteSetURL(ctx context.Context, name, newurl string, opts
type RemoteSetURLAddOptions struct {
// Indicates whether to get push URLs instead of fetch URLs.
Push bool
// The additional options to be passed to the underlying Git.
CommandOptions
}

Expand Down Expand Up @@ -278,7 +271,6 @@ func (r *Repository) RemoteSetURLAdd(ctx context.Context, name, newurl string, o
type RemoteSetURLDeleteOptions struct {
// Indicates whether to get push URLs instead of fetch URLs.
Push bool
// The additional options to be passed to the underlying Git.
CommandOptions
}

Expand Down
4 changes: 0 additions & 4 deletions repo_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ func (r *Repository) getTag(ctx context.Context, id *SHA1) (*Tag, error) {
//
// Docs: https://git-scm.com/docs/git-cat-file
type TagOptions struct {
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -140,7 +139,6 @@ type TagsOptions struct {
SortKey string
// Pattern filters tags matching the specified pattern.
Pattern string
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -183,7 +181,6 @@ type CreateTagOptions struct {
Message string
// Author is the author of the tag. It is ignored when tag is not annotated.
Author *Signature
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down Expand Up @@ -216,7 +213,6 @@ func (r *Repository) CreateTag(ctx context.Context, name, rev string, opts ...Cr
//
// Docs: https://git-scm.com/docs/git-tag#Documentation/git-tag.txt---delete
type DeleteTagOptions struct {
// The additional options to be passed to the underlying git.
CommandOptions
}

Expand Down
Loading