diff options
Diffstat (limited to 'options.go')
-rw-r--r-- | options.go | 45 |
1 files changed, 35 insertions, 10 deletions
@@ -50,6 +50,9 @@ type CloneOptions struct { // stored, if nil nothing is stored and the capability (if supported) // no-progress, is sent to the server to avoid send this information. Progress sideband.Progress + // Tags describe how the tags will be fetched from the remote repository, + // by default is AllTags. + Tags TagMode } // Validate validates the fields and sets the default values. @@ -66,6 +69,10 @@ func (o *CloneOptions) Validate() error { o.ReferenceName = plumbing.HEAD } + if o.Tags == InvalidTagMode { + o.Tags = AllTags + } + return nil } @@ -103,18 +110,19 @@ func (o *PullOptions) Validate() error { return nil } -type TagFetchMode int +type TagMode int -var ( +const ( + InvalidTagMode TagMode = iota // TagFollowing any tag that points into the histories being fetched is also // fetched. TagFollowing requires a server with `include-tag` capability // in order to fetch the annotated tags objects. - TagFollowing TagFetchMode = 0 + TagFollowing // AllTags fetch all tags from the remote (i.e., fetch remote tags // refs/tags/* into local tags with the same name) - AllTags TagFetchMode = 1 + AllTags //NoTags fetch no tags from the remote at all - NoTags TagFetchMode = 2 + NoTags ) // FetchOptions describes how a fetch should be performed @@ -133,7 +141,7 @@ type FetchOptions struct { Progress sideband.Progress // Tags describe how the tags will be fetched from the remote repository, // by default is TagFollowing. - Tags TagFetchMode + Tags TagMode } // Validate validates the fields and sets the default values. @@ -142,6 +150,10 @@ func (o *FetchOptions) Validate() error { o.RemoteName = DefaultRemoteName } + if o.Tags == InvalidTagMode { + o.Tags = TagFollowing + } + for _, r := range o.RefSpecs { if err := r.Validate(); err != nil { return err @@ -160,6 +172,9 @@ type PushOptions struct { RefSpecs []config.RefSpec // Auth credentials, if required, to use with the remote repository. Auth transport.AuthMethod + // Progress is where the human readable information sent by the server is + // stored, if nil nothing is stored. + Progress sideband.Progress } // Validate validates the fields and sets the default values. @@ -238,13 +253,13 @@ func (o *CheckoutOptions) Validate() error { type ResetMode int8 const ( - // HardReset resets the index and working tree. Any changes to tracked files - // in the working tree are discarded. - HardReset ResetMode = iota // MixedReset resets the index but not the working tree (i.e., the changed // files are preserved but not marked for commit) and reports what has not // been updated. This is the default action. - MixedReset + MixedReset ResetMode = iota + // HardReset resets the index and working tree. Any changes to tracked files + // in the working tree are discarded. + HardReset // MergeReset resets the index and updates the files in the working tree // that are different between Commit and HEAD, but keeps those which are // different between the index and working tree (i.e. which have changes @@ -253,6 +268,10 @@ const ( // If a file that is different between Commit and the index has unstaged // changes, reset is aborted. MergeReset + // SoftReset does not touch the index file or the working tree at all (but + // resets the head to <commit>, just like all modes do). This leaves all + // your changed files "Changes to be committed", as git status would put it. + SoftReset ) // ResetOptions describes how a reset operation should be performed. @@ -329,3 +348,9 @@ func (o *CommitOptions) Validate(r *Repository) error { return nil } + +// ListOptions describes how a remote list should be performed. +type ListOptions struct { + // Auth credentials, if required, to use with the remote repository. + Auth transport.AuthMethod +} |