aboutsummaryrefslogtreecommitdiffstats
path: root/options.go
diff options
context:
space:
mode:
Diffstat (limited to 'options.go')
-rw-r--r--options.go42
1 files changed, 39 insertions, 3 deletions
diff --git a/options.go b/options.go
index 7068796..d6f0e9f 100644
--- a/options.go
+++ b/options.go
@@ -91,6 +91,8 @@ func (o *CloneOptions) Validate() error {
type PullOptions struct {
// Name of the remote to be pulled. If empty, uses the default.
RemoteName string
+ // RemoteURL overrides the remote repo address with a custom URL
+ RemoteURL string
// Remote branch to clone. If empty, uses HEAD.
ReferenceName plumbing.ReferenceName
// Fetch only ReferenceName if true.
@@ -147,7 +149,9 @@ const (
type FetchOptions struct {
// Name of the remote to fetch from. Defaults to origin.
RemoteName string
- RefSpecs []config.RefSpec
+ // RemoteURL overrides the remote repo address with a custom URL
+ RemoteURL string
+ RefSpecs []config.RefSpec
// Depth limit fetching to the specified number of commits from the tip of
// each remote branch history.
Depth int
@@ -192,8 +196,16 @@ func (o *FetchOptions) Validate() error {
type PushOptions struct {
// RemoteName is the name of the remote to be pushed to.
RemoteName string
- // RefSpecs specify what destination ref to update with what source
- // object. A refspec with empty src can be used to delete a reference.
+ // RemoteURL overrides the remote repo address with a custom URL
+ RemoteURL string
+ // RefSpecs specify what destination ref to update with what source object.
+ //
+ // The format of a <refspec> parameter is an optional plus +, followed by
+ // the source object <src>, followed by a colon :, followed by the destination ref <dst>.
+ // The <src> is often the name of the branch you would want to push, but it can be a SHA-1.
+ // The <dst> tells which ref on the remote side is updated with this push.
+ //
+ // A refspec with empty src can be used to delete a reference.
RefSpecs []config.RefSpec
// Auth credentials, if required, to use with the remote repository.
Auth transport.AuthMethod
@@ -213,6 +225,28 @@ type PushOptions struct {
// RequireRemoteRefs only allows a remote ref to be updated if its current
// value is the one specified here.
RequireRemoteRefs []config.RefSpec
+ // FollowTags will send any annotated tags with a commit target reachable from
+ // the refs already being pushed
+ FollowTags bool
+ // ForceWithLease allows a force push as long as the remote ref adheres to a "lease"
+ ForceWithLease *ForceWithLease
+ // PushOptions sets options to be transferred to the server during push.
+ Options map[string]string
+ // Atomic sets option to be an atomic push
+ Atomic bool
+}
+
+// ForceWithLease sets fields on the lease
+// If neither RefName nor Hash are set, ForceWithLease protects
+// all refs in the refspec by ensuring the ref of the remote in the local repsitory
+// matches the one in the ref advertisement.
+type ForceWithLease struct {
+ // RefName, when set will protect the ref by ensuring it matches the
+ // hash in the ref advertisement.
+ RefName plumbing.ReferenceName
+ // Hash is the expected object id of RefName. The push will be rejected unless this
+ // matches the corresponding object id of RefName in the refs advertisement.
+ Hash plumbing.Hash
}
// Validate validates the fields and sets the default values.
@@ -274,6 +308,8 @@ type CheckoutOptions struct {
// target branch. Force and Keep are mutually exclusive, should not be both
// set to true.
Keep bool
+ // SparseCheckoutDirectories
+ SparseCheckoutDirectories []string
}
// Validate validates the fields and sets the default values.