From 5e64929185218f53cb45b0f89fb372e06aa172be Mon Sep 17 00:00:00 2001 From: Norwin Date: Wed, 15 Sep 2021 15:34:17 +0200 Subject: Add RemoteURL to {Fetch,Pull,Push}Options Can be used to override the URL to operate on: RemoteName will be ignored for the actual fetch --- options.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'options.go') diff --git a/options.go b/options.go index 7068796..ce04189 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,6 +196,8 @@ func (o *FetchOptions) Validate() error { type PushOptions struct { // RemoteName is the name of the remote to be pushed to. RemoteName string + // RemoteURL overrides the remote repo address with a custom URL + RemoteURL string // RefSpecs specify what destination ref to update with what source // object. A refspec with empty src can be used to delete a reference. RefSpecs []config.RefSpec -- cgit From 5340c58e393abecadb651e5f7ef43a66ce34ac88 Mon Sep 17 00:00:00 2001 From: John Cai Date: Sat, 2 Oct 2021 22:51:36 -0400 Subject: git: add --follow-tags option for pushes This PR adds support for the --follow-tags option for pushes. --- options.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'options.go') diff --git a/options.go b/options.go index 7068796..6137ae7 100644 --- a/options.go +++ b/options.go @@ -213,6 +213,9 @@ 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 } // Validate validates the fields and sets the default values. -- cgit From e729edb00d36e9bd19f99dfa493984233b0dccfa Mon Sep 17 00:00:00 2001 From: Sören Bohn Date: Tue, 26 Oct 2021 15:49:15 +0200 Subject: plumbing: packp, Add encoding for push-options. Fixes #268. go-git: Add field `Options` to `PushOptions`, wire functionality. --- options.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'options.go') diff --git a/options.go b/options.go index 3bd6876..84bf947 100644 --- a/options.go +++ b/options.go @@ -222,6 +222,8 @@ type PushOptions struct { // FollowTags will send any annotated tags with a commit target reachable from // the refs already being pushed FollowTags bool + // PushOptions sets options to be transferred to the server during push. + Options map[string]string } // Validate validates the fields and sets the default values. -- cgit From 21d8d7e95144eca38e93120b575c0ebd436e0e24 Mon Sep 17 00:00:00 2001 From: Thibault Jamet Date: Tue, 1 Jun 2021 23:33:46 +0200 Subject: Document the push refspec format Taken from `git help push` and adapted to match the supported features only. Future iterations of this feature may include better support for git "SHA-1 expression", documented in `git help push` as: > any arbitrary "SHA-1 expression", such as master~4 or HEAD (see gitrevisions(7)). --- options.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'options.go') diff --git a/options.go b/options.go index 3bd6876..b71299b 100644 --- a/options.go +++ b/options.go @@ -198,8 +198,14 @@ type PushOptions struct { RemoteName string // RemoteURL overrides the remote repo address with a custom URL RemoteURL string - // RefSpecs specify what destination ref to update with what source - // object. A refspec with empty src can be used to delete a reference. + // RefSpecs specify what destination ref to update with what source object. + // + // The format of a parameter is an optional plus +, followed by + // the source object , followed by a colon :, followed by the destination ref . + // The is often the name of the branch you would want to push, but it can be a SHA-1. + // The 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 -- cgit