@@ -54,7 +54,6 @@ func (r *Repository) parsePrettyFormatLogToList(ctx context.Context, logs []byte
5454type InitOptions struct {
5555 // Indicates whether the repository should be initialized in bare format.
5656 Bare bool
57- // The additional options to be passed to the underlying git.
5857 CommandOptions
5958}
6059
@@ -111,7 +110,6 @@ type CloneOptions struct {
111110 Branch string
112111 // The number of revisions to clone.
113112 Depth uint64
114- // The additional options to be passed to the underlying git.
115113 CommandOptions
116114}
117115
@@ -155,7 +153,6 @@ func Clone(ctx context.Context, url, dst string, opts ...CloneOptions) error {
155153type FetchOptions struct {
156154 // Indicates whether to prune during fetching.
157155 Prune bool
158- // The additional options to be passed to the underlying git.
159156 CommandOptions
160157}
161158
@@ -188,7 +185,6 @@ type PullOptions struct {
188185 Remote string
189186 // The branch to pull updates from when All=false and Remote is supplied.
190187 Branch string
191- // The additional options to be passed to the underlying git.
192188 CommandOptions
193189}
194190
@@ -222,7 +218,8 @@ func (r *Repository) Pull(ctx context.Context, opts ...PullOptions) error {
222218//
223219// Docs: https://git-scm.com/docs/git-push
224220type PushOptions struct {
225- // The additional options to be passed to the underlying git.
221+ // Indicates whether to set upstream tracking for the branch.
222+ SetUpstream bool
226223 CommandOptions
227224}
228225
@@ -233,7 +230,11 @@ func (r *Repository) Push(ctx context.Context, remote, branch string, opts ...Pu
233230 opt = opts [0 ]
234231 }
235232
236- args := []string {"push" , "--end-of-options" , remote , branch }
233+ args := []string {"push" }
234+ if opt .SetUpstream {
235+ args = append (args , "-u" )
236+ }
237+ args = append (args , "--end-of-options" , remote , branch )
237238 _ , err := exec (ctx , r .path , args , opt .Envs )
238239 return err
239240}
@@ -244,7 +245,6 @@ func (r *Repository) Push(ctx context.Context, remote, branch string, opts ...Pu
244245type CheckoutOptions struct {
245246 // The base branch if checks out to a new branch.
246247 BaseBranch string
247- // The additional options to be passed to the underlying git.
248248 CommandOptions
249249}
250250
@@ -272,7 +272,6 @@ func (r *Repository) Checkout(ctx context.Context, branch string, opts ...Checko
272272type ResetOptions struct {
273273 // Indicates whether to perform a hard reset.
274274 Hard bool
275- // The additional options to be passed to the underlying git.
276275 CommandOptions
277276}
278277
@@ -298,7 +297,6 @@ func (r *Repository) Reset(ctx context.Context, rev string, opts ...ResetOptions
298297//
299298// Docs: https://git-scm.com/docs/git-mv
300299type MoveOptions struct {
301- // The additional options to be passed to the underlying git.
302300 CommandOptions
303301}
304302
@@ -323,7 +321,6 @@ type AddOptions struct {
323321 All bool
324322 // The specific pathspecs to be added to index.
325323 Pathspecs []string
326- // The additional options to be passed to the underlying git.
327324 CommandOptions
328325}
329326
@@ -352,7 +349,6 @@ func (r *Repository) Add(ctx context.Context, opts ...AddOptions) error {
352349type CommitOptions struct {
353350 // Author is the author of the changes if that's not the same as committer.
354351 Author * Signature
355- // The additional options to be passed to the underlying git.
356352 CommandOptions
357353}
358354
@@ -395,7 +391,6 @@ type NameStatus struct {
395391//
396392// Docs: https://git-scm.com/docs/git-show#Documentation/git-show.txt---name-status
397393type ShowNameStatusOptions struct {
398- // The additional options to be passed to the underlying git.
399394 CommandOptions
400395}
401396
@@ -445,7 +440,6 @@ func (r *Repository) ShowNameStatus(ctx context.Context, rev string, opts ...Sho
445440//
446441// Docs: https://git-scm.com/docs/git-rev-parse
447442type RevParseOptions struct {
448- // The additional options to be passed to the underlying git.
449443 CommandOptions
450444}
451445
@@ -485,7 +479,6 @@ type CountObject struct {
485479//
486480// Docs: https://git-scm.com/docs/git-count-objects
487481type CountObjectsOptions struct {
488- // The additional options to be passed to the underlying git.
489482 CommandOptions
490483}
491484
@@ -537,7 +530,6 @@ func (r *Repository) CountObjects(ctx context.Context, opts ...CountObjectsOptio
537530//
538531// Docs: https://git-scm.com/docs/git-fsck
539532type FsckOptions struct {
540- // The additional options to be passed to the underlying git.
541533 CommandOptions
542534}
543535
0 commit comments