aboutsummaryrefslogtreecommitdiffstats
path: root/options.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-01-30 16:13:56 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2017-01-30 16:13:56 +0100
commit35378e7db9288e8244f2634a1b47981606731cef (patch)
tree65936a6a365263c93e4b57c3b67aad6a13489e68 /options.go
parent45669655f026a31577f938ee70ae613c2e4af184 (diff)
parenta48bc6e17ef6298f93ec21cdf1a5e387640673b6 (diff)
downloadgo-git-35378e7db9288e8244f2634a1b47981606731cef.tar.gz
example: using new constructors
Diffstat (limited to 'options.go')
-rw-r--r--options.go29
1 files changed, 21 insertions, 8 deletions
diff --git a/options.go b/options.go
index cb0859b..8abace2 100644
--- a/options.go
+++ b/options.go
@@ -5,6 +5,7 @@ import (
"gopkg.in/src-d/go-git.v4/config"
"gopkg.in/src-d/go-git.v4/plumbing"
+ "gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/sideband"
"gopkg.in/src-d/go-git.v4/plumbing/transport"
)
@@ -18,7 +19,7 @@ var (
ErrInvalidRefSpec = errors.New("invalid refspec")
)
-// CloneOptions describe how a clone should be perform
+// CloneOptions describes how a clone should be performed
type CloneOptions struct {
// The (possibly remote) repository URL to clone from
URL string
@@ -32,9 +33,13 @@ type CloneOptions struct {
SingleBranch bool
// Limit fetching to the specified number of commits
Depth int
+ // Progress is where the human readable information sent by the server is
+ // 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
}
-// Validate validate the fields and set the default values
+// Validate validates the fields and sets the default values
func (o *CloneOptions) Validate() error {
if o.URL == "" {
return ErrMissingURL
@@ -51,7 +56,7 @@ func (o *CloneOptions) Validate() error {
return nil
}
-// PullOptions describe how a pull should be perform.
+// PullOptions describes how a pull should be performed
type PullOptions struct {
// Name of the remote to be pulled. If empty, uses the default.
RemoteName string
@@ -63,9 +68,13 @@ type PullOptions struct {
Depth int
// 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 and the capability (if supported)
+ // no-progress, is sent to the server to avoid send this information
+ Progress sideband.Progress
}
-// Validate validate the fields and set the default values.
+// Validate validates the fields and sets the default values.
func (o *PullOptions) Validate() error {
if o.RemoteName == "" {
o.RemoteName = DefaultRemoteName
@@ -78,7 +87,7 @@ func (o *PullOptions) Validate() error {
return nil
}
-// FetchOptions describe how a fetch should be perform
+// FetchOptions describes how a fetch should be performed
type FetchOptions struct {
// Name of the remote to fetch from. Defaults to origin.
RemoteName string
@@ -88,9 +97,13 @@ type FetchOptions struct {
Depth int
// 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 and the capability (if supported)
+ // no-progress, is sent to the server to avoid send this information
+ Progress sideband.Progress
}
-// Validate validate the fields and set the default values
+// Validate validates the fields and sets the default values
func (o *FetchOptions) Validate() error {
if o.RemoteName == "" {
o.RemoteName = DefaultRemoteName
@@ -105,7 +118,7 @@ func (o *FetchOptions) Validate() error {
return nil
}
-// PushOptions describe how a push should be performed.
+// PushOptions describes how a push should be performed
type PushOptions struct {
// RemoteName is the name of the remote to be pushed to.
RemoteName string
@@ -116,7 +129,7 @@ type PushOptions struct {
Auth transport.AuthMethod
}
-// Validate validate the fields and set the default values
+// Validate validates the fields and sets the default values
func (o *PushOptions) Validate() error {
if o.RemoteName == "" {
o.RemoteName = DefaultRemoteName