diff --git a/cmd/bazel-git/fetch.go b/cmd/bazel-git/fetch.go index 7da1f024589dcabeac378b3208d471679946f0fa..16a731dfa890a7a0e7435edc00398650b2120729 100644 --- a/cmd/bazel-git/fetch.go +++ b/cmd/bazel-git/fetch.go @@ -9,8 +9,9 @@ import ( ) type FetchCommand struct { - Depth int `long:"depth" value-name:"" description:"Limit fetching the specified number of commits from the tip of each remote branch history." require:"yes"` - NoWriteFetchHead bool `long:"no-write-fetch-head" description:"Does not write **FETCH_HEAD**." required:"yes"` + Depth int `long:"depth" value-name:"" description:"Limit fetching the specified number of commits from the tip of each remote branch history." require:"yes"` + NoWriteFetchHead bool `long:"no-write-fetch-head" description:"Does not write **FETCH_HEAD**." required:"yes"` + NegotiationTips []reference.Commitish `long:"negotiation-tip" value-name:"" description:"Determines the tips to use in negoatiating a smaller packfile transfer. Can be defined multiple times."` Args struct { Remote remote.URL `positional-arg-name:"repository" description:"The remote to retrieve objects from."` Commitishes []reference.Commitish `positional-arg-name:"refspec" description:"The committish to retrieve from the server. Usually a commit SHA but can be a resolvable reference."` @@ -20,8 +21,13 @@ type FetchCommand struct { var fetchCommand FetchCommand func (x *FetchCommand) Execute(_ []string) error { - log := slog.With("namespace", "fetch") + log := slog.With("namespace", "fetch", "remote", x.Args.Remote) log.Debug("fetching", "commitishes", x.Args.Commitishes) + + if len(x.NegotiationTips) > 0 { + log.Warn("Negotiation tips are not currently supported. A large packfile may be transferred", "negotiation-tips", x.NegotiationTips) + } + err := fetch.Commitishes(fetch.CommitishesOptions{ Remote: x.Args.Remote, Commitishes: x.Args.Commitishes,