From 19b39e150071832541f2cdcb669446a8609f57e7 Mon Sep 17 00:00:00 2001 From: Paulo Gomes Date: Wed, 3 May 2023 08:39:07 +0100 Subject: git: Add support to ls-remote with peeled references. Fixes #749 A new PeelingOption field was introduced into ListOptions. The new options include the default (and backwards compatible) IgnorePeeled. Plus another two variations which either only returns peeled references (OnlyPeeled), or append peeled references to the list (AppendPeeled). The ls-remote example was updated to align with upstream, in which peeled references are appended to the results by default. A new ErrEmptyUrls error is now returned when List or ListContext do not receive a URL to work with, to improve overall execution flow. Signed-off-by: Paulo Gomes --- options.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'options.go') diff --git a/options.go b/options.go index e79cf9d..04c83de 100644 --- a/options.go +++ b/options.go @@ -624,8 +624,28 @@ type ListOptions struct { InsecureSkipTLS bool // CABundle specify additional ca bundle with system cert pool CABundle []byte + + // PeelingOption defines how peeled objects are handled during a + // remote list. + PeelingOption PeelingOption } +// PeelingOption represents the different ways to handle peeled references. +// +// Peeled references represent the underlying object of an annotated +// (or signed) tag. Refer to upstream documentation for more info: +// https://github.com/git/git/blob/master/Documentation/technical/reftable.txt +type PeelingOption uint8 + +const ( + // IgnorePeeled ignores all peeled reference names. This is the default behavior. + IgnorePeeled PeelingOption = 0 + // OnlyPeeled returns only peeled reference names. + OnlyPeeled PeelingOption = 1 + // AppendPeeled appends peeled reference names to the reference list. + AppendPeeled PeelingOption = 2 +) + // CleanOptions describes how a clean should be performed. type CleanOptions struct { Dir bool -- cgit