1048 lines
33 KiB
Plaintext
1048 lines
33 KiB
Plaintext
// `autogen:go.mod`
|
|
|
|
module go.wit.com/lib/protobuf/gitpb
|
|
|
|
go 1.22
|
|
|
|
toolchain go1.23.4
|
|
|
|
require (
|
|
github.com/destel/rill v0.7.0
|
|
github.com/go-cmd/cmd v1.4.3
|
|
go.wit.com/lib/gui/shell v0.22.23
|
|
go.wit.com/log v0.22.11
|
|
google.golang.org/protobuf v1.36.5
|
|
)
|
|
|
|
// `autogen:go.sum`
|
|
|
|
github.com/destel/rill v0.7.0 h1:LJUbeMACaO+/e8rUNk940kYVESD/dbrhAp6M14IjQ0c=
|
|
github.com/destel/rill v0.7.0/go.mod h1:srKuXzvGqINUEGYR5b/iwvW+L9/S35RxVHWGYbXNoO4=
|
|
github.com/go-cmd/cmd v1.4.3 h1:6y3G+3UqPerXvPcXvj+5QNPHT02BUw7p6PsqRxLNA7Y=
|
|
github.com/go-cmd/cmd v1.4.3/go.mod h1:u3hxg/ry+D5kwh8WvUkHLAMe2zQCaXd00t35WfQaOFk=
|
|
github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg=
|
|
github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
|
|
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
go.wit.com/lib/gui/shell v0.22.23 h1:U6Njsme2NU7ntcopcSXHD9bNYZzzeQueSTRB/L1YrgE=
|
|
go.wit.com/lib/gui/shell v0.22.23/go.mod h1:K6+ULaS8xQFcsi1QoWHY1+PM/vS+IRSyJvbnJF9GyIQ=
|
|
go.wit.com/log v0.22.11 h1:BiJe+S81kWrMqW1QyZVu1Es2d//WG9FAcZQEhZkkM4c=
|
|
go.wit.com/log v0.22.11/go.mod h1:LsP0nAH4hZEf2qj/F5UmGQT0OEJ3Q5698/P8ZOI2JuE=
|
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
|
|
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
|
|
|
// `autogen:gitTag.marshal.pb.go`
|
|
|
|
// Code generated by go.wit.com/apps/autogenpb DO NOT EDIT.
|
|
// This file was autogenerated with autogenpb v0.0.49-2-g9a0e4a6 2025.02.01_0732
|
|
// go install go.wit.com/apps/autogenpb@latest
|
|
//
|
|
// define which structs (messages) you want to use in the .proto file
|
|
// Then sort.pb.go and marshal.pb.go files are autogenerated
|
|
//
|
|
// autogenpb uses it and has an example .proto file with instructions
|
|
//
|
|
|
|
package gitpb
|
|
|
|
import (
|
|
"google.golang.org/protobuf/encoding/protojson"
|
|
"google.golang.org/protobuf/encoding/prototext"
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
// human readable JSON
|
|
func (v *GitTags) FormatJSON() string {
|
|
return protojson.Format(v)
|
|
}
|
|
|
|
// marshal json
|
|
func (v *GitTags) MarshalJSON() ([]byte, error) {
|
|
return protojson.Marshal(v)
|
|
}
|
|
|
|
// unmarshal json
|
|
func (v *GitTags) UnmarshalJSON(data []byte) error {
|
|
return protojson.Unmarshal(data, v)
|
|
}
|
|
|
|
// apparently this isn't stable, but it's awesomely better
|
|
// https://protobuf.dev/reference/go/faq/#unstable-text
|
|
// it's brilliant for config files!
|
|
func (v *GitTags) FormatTEXT() string {
|
|
v.fixUuid()
|
|
return prototext.Format(v)
|
|
}
|
|
|
|
// unmarshalTEXT. This reads the .text config file back in after the user edits it
|
|
func (v *GitTags) UnmarshalTEXT(data []byte) error {
|
|
return prototext.Unmarshal(data, v)
|
|
}
|
|
|
|
// marshal to wire. This is called winning.
|
|
func (v *GitTags) Marshal() ([]byte, error) {
|
|
v.fixUuid()
|
|
return proto.Marshal(v)
|
|
}
|
|
|
|
// unmarshal from wire. You have won.
|
|
func (v *GitTags) Unmarshal(data []byte) error {
|
|
return proto.Unmarshal(data, v)
|
|
}
|
|
|
|
// `autogen:gitTag.pb.go`
|
|
|
|
// Code modified by go.wit.com/apps/autogenpb DO NOT EDIT.
|
|
//
|
|
// user defined Mutex locks were auto added
|
|
//
|
|
// autogenpb version & build time: v0.0.49-2-g9a0e4a6 2025.02.01_0732
|
|
// autogenpb auto generates Sort(), Unique() and Marshal() functions
|
|
// go install go.wit.com/apps/autogenpb@latest
|
|
|
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
// versions:
|
|
// protoc-gen-go v1.35.2-devel
|
|
// protoc v3.21.12
|
|
// source: gitTag.proto
|
|
|
|
package gitpb // autogenpb changed the package name
|
|
|
|
import (
|
|
reflect "reflect"
|
|
sync "sync"
|
|
|
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
|
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
|
)
|
|
|
|
const (
|
|
// Verify that this generated code is sufficiently up-to-date.
|
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
|
)
|
|
|
|
type GitRemote struct {
|
|
// sync.RWMutex // skipped. protobuf file has `autogenpb:nomutex`
|
|
|
|
state protoimpl.MessageState
|
|
sizeCache protoimpl.SizeCache
|
|
unknownFields protoimpl.UnknownFields
|
|
|
|
Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
|
|
Fetch string `protobuf:"bytes,2,opt,name=fetch,proto3" json:"fetch,omitempty"`
|
|
}
|
|
|
|
func (x *GitRemote) Reset() {
|
|
*x = GitRemote{}
|
|
mi := &file_gitTag_proto_msgTypes[0]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *GitRemote) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*GitRemote) ProtoMessage() {}
|
|
|
|
func (x *GitRemote) ProtoReflect() protoreflect.Message {
|
|
mi := &file_gitTag_proto_msgTypes[0]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use GitRemote.ProtoReflect.Descriptor instead.
|
|
func (*GitRemote) Descriptor() ([]byte, []int) {
|
|
return file_gitTag_proto_rawDescGZIP(), []int{0}
|
|
}
|
|
|
|
func (x *GitRemote) GetUrl() string {
|
|
if x != nil {
|
|
return x.Url
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *GitRemote) GetFetch() string {
|
|
if x != nil {
|
|
return x.Fetch
|
|
}
|
|
return ""
|
|
}
|
|
|
|
type GitBranch struct {
|
|
// sync.RWMutex // skipped. protobuf file has `autogenpb:nomutex`
|
|
|
|
state protoimpl.MessageState
|
|
sizeCache protoimpl.SizeCache
|
|
unknownFields protoimpl.UnknownFields
|
|
|
|
Remote string `protobuf:"bytes,1,opt,name=remote,proto3" json:"remote,omitempty"` // the name of the remote repo
|
|
Merge string `protobuf:"bytes,2,opt,name=merge,proto3" json:"merge,omitempty"` // the merge path from the config file
|
|
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // the branch name from the config file
|
|
}
|
|
|
|
func (x *GitBranch) Reset() {
|
|
*x = GitBranch{}
|
|
mi := &file_gitTag_proto_msgTypes[1]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *GitBranch) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*GitBranch) ProtoMessage() {}
|
|
|
|
func (x *GitBranch) ProtoReflect() protoreflect.Message {
|
|
mi := &file_gitTag_proto_msgTypes[1]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use GitBranch.ProtoReflect.Descriptor instead.
|
|
func (*GitBranch) Descriptor() ([]byte, []int) {
|
|
return file_gitTag_proto_rawDescGZIP(), []int{1}
|
|
}
|
|
|
|
func (x *GitBranch) GetRemote() string {
|
|
if x != nil {
|
|
return x.Remote
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *GitBranch) GetMerge() string {
|
|
if x != nil {
|
|
return x.Merge
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *GitBranch) GetName() string {
|
|
if x != nil {
|
|
return x.Name
|
|
}
|
|
return ""
|
|
}
|
|
|
|
// readGitConfig reads and parses the .git/config file
|
|
type GitConfig struct {
|
|
// sync.RWMutex // skipped. protobuf file has `autogenpb:nomutex`
|
|
|
|
state protoimpl.MessageState
|
|
sizeCache protoimpl.SizeCache
|
|
unknownFields protoimpl.UnknownFields
|
|
|
|
Core map[string]string `protobuf:"bytes,1,rep,name=core,proto3" json:"core,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // map[origin] = "https:/git.wit.org/gui/gadgets"
|
|
Remotes map[string]*GitRemote `protobuf:"bytes,2,rep,name=remotes,proto3" json:"remotes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // map[origin] = "https:/git.wit.org/gui/gadgets"
|
|
Branches map[string]*GitBranch `protobuf:"bytes,3,rep,name=branches,proto3" json:"branches,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // map[guimaster] = origin guimaster
|
|
Submodules map[string]string `protobuf:"bytes,4,rep,name=submodules,proto3" json:"submodules,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
|
Hashes map[string]string `protobuf:"bytes,5,rep,name=hashes,proto3" json:"hashes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
|
Versions map[string]string `protobuf:"bytes,6,rep,name=versions,proto3" json:"versions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
|
Local []*GitBranch `protobuf:"bytes,7,rep,name=local,proto3" json:"local,omitempty"` // move this this and away from the map<> variables
|
|
}
|
|
|
|
func (x *GitConfig) Reset() {
|
|
*x = GitConfig{}
|
|
mi := &file_gitTag_proto_msgTypes[2]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *GitConfig) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*GitConfig) ProtoMessage() {}
|
|
|
|
func (x *GitConfig) ProtoReflect() protoreflect.Message {
|
|
mi := &file_gitTag_proto_msgTypes[2]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use GitConfig.ProtoReflect.Descriptor instead.
|
|
func (*GitConfig) Descriptor() ([]byte, []int) {
|
|
return file_gitTag_proto_rawDescGZIP(), []int{2}
|
|
}
|
|
|
|
func (x *GitConfig) GetCore() map[string]string {
|
|
if x != nil {
|
|
return x.Core
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *GitConfig) GetRemotes() map[string]*GitRemote {
|
|
if x != nil {
|
|
return x.Remotes
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *GitConfig) GetBranches() map[string]*GitBranch {
|
|
if x != nil {
|
|
return x.Branches
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *GitConfig) GetSubmodules() map[string]string {
|
|
if x != nil {
|
|
return x.Submodules
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *GitConfig) GetHashes() map[string]string {
|
|
if x != nil {
|
|
return x.Hashes
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *GitConfig) GetVersions() map[string]string {
|
|
if x != nil {
|
|
return x.Versions
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *GitConfig) GetLocal() []*GitBranch {
|
|
if x != nil {
|
|
return x.Local
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type GitTag struct {
|
|
// sync.RWMutex // skipped. protobuf file has `autogenpb:nomutex`
|
|
|
|
state protoimpl.MessageState
|
|
sizeCache protoimpl.SizeCache
|
|
unknownFields protoimpl.UnknownFields
|
|
|
|
Refname string `protobuf:"bytes,1,opt,name=refname,proto3" json:"refname,omitempty"` // `autogenpb:unique` `autogenpb:sort` // tag name. treated as unique
|
|
Creatordate *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=creatordate,proto3" json:"creatordate,omitempty"` // git creatordate
|
|
Authordate *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=authordate,proto3" json:"authordate,omitempty"` // git author date
|
|
Hash string `protobuf:"bytes,4,opt,name=hash,proto3" json:"hash,omitempty"` // `autogenpb:unique` // git hash
|
|
Subject string `protobuf:"bytes,5,opt,name=subject,proto3" json:"subject,omitempty"` // git tag subject
|
|
}
|
|
|
|
func (x *GitTag) Reset() {
|
|
*x = GitTag{}
|
|
mi := &file_gitTag_proto_msgTypes[3]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *GitTag) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*GitTag) ProtoMessage() {}
|
|
|
|
func (x *GitTag) ProtoReflect() protoreflect.Message {
|
|
mi := &file_gitTag_proto_msgTypes[3]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use GitTag.ProtoReflect.Descriptor instead.
|
|
func (*GitTag) Descriptor() ([]byte, []int) {
|
|
return file_gitTag_proto_rawDescGZIP(), []int{3}
|
|
}
|
|
|
|
func (x *GitTag) GetRefname() string {
|
|
if x != nil {
|
|
return x.Refname
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *GitTag) GetCreatordate() *timestamppb.Timestamp {
|
|
if x != nil {
|
|
return x.Creatordate
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *GitTag) GetAuthordate() *timestamppb.Timestamp {
|
|
if x != nil {
|
|
return x.Authordate
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *GitTag) GetHash() string {
|
|
if x != nil {
|
|
return x.Hash
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *GitTag) GetSubject() string {
|
|
if x != nil {
|
|
return x.Subject
|
|
}
|
|
return ""
|
|
}
|
|
|
|
type GitTags struct {
|
|
// sync.RWMutex // skipped. protobuf file has `autogenpb:nomutex`
|
|
|
|
state protoimpl.MessageState
|
|
sizeCache protoimpl.SizeCache
|
|
unknownFields protoimpl.UnknownFields
|
|
|
|
Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` // `autogenpb:uuid:ffdff813-0316-4372-9e82-4c1c7d202526`
|
|
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // `autogenpb:version:v0.0.47`
|
|
GitTags []*GitTag `protobuf:"bytes,3,rep,name=gitTags,proto3" json:"gitTags,omitempty"`
|
|
}
|
|
|
|
func (x *GitTags) Reset() {
|
|
*x = GitTags{}
|
|
mi := &file_gitTag_proto_msgTypes[4]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *GitTags) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*GitTags) ProtoMessage() {}
|
|
|
|
func (x *GitTags) ProtoReflect() protoreflect.Message {
|
|
mi := &file_gitTag_proto_msgTypes[4]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use GitTags.ProtoReflect.Descriptor instead.
|
|
func (*GitTags) Descriptor() ([]byte, []int) {
|
|
return file_gitTag_proto_rawDescGZIP(), []int{4}
|
|
}
|
|
|
|
func (x *GitTags) GetUuid() string {
|
|
if x != nil {
|
|
return x.Uuid
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *GitTags) GetVersion() string {
|
|
if x != nil {
|
|
return x.Version
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *GitTags) GetGitTags() []*GitTag {
|
|
if x != nil {
|
|
return x.GitTags
|
|
}
|
|
return nil
|
|
}
|
|
|
|
var File_gitTag_proto protoreflect.FileDescriptor
|
|
|
|
var file_gitTag_proto_rawDesc = []byte{
|
|
0x0a, 0x0c, 0x67, 0x69, 0x74, 0x54, 0x61, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05,
|
|
0x67, 0x69, 0x74, 0x70, 0x62, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72,
|
|
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
|
|
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x33, 0x0a, 0x09, 0x47, 0x69, 0x74, 0x52, 0x65, 0x6d,
|
|
0x6f, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
|
0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x65, 0x74, 0x63, 0x68, 0x18, 0x02,
|
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x66, 0x65, 0x74, 0x63, 0x68, 0x22, 0x4d, 0x0a, 0x09, 0x47,
|
|
0x69, 0x74, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x6f,
|
|
0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65,
|
|
0x12, 0x14, 0x0a, 0x05, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
|
0x05, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03,
|
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x99, 0x06, 0x0a, 0x09, 0x47,
|
|
0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2e, 0x0a, 0x04, 0x63, 0x6f, 0x72, 0x65,
|
|
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x47,
|
|
0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, 0x6f, 0x72, 0x65, 0x45, 0x6e, 0x74,
|
|
0x72, 0x79, 0x52, 0x04, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x72, 0x65, 0x6d, 0x6f,
|
|
0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x69, 0x74, 0x70,
|
|
0x62, 0x2e, 0x47, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x52, 0x65, 0x6d, 0x6f,
|
|
0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65,
|
|
0x73, 0x12, 0x3a, 0x0a, 0x08, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x18, 0x03, 0x20,
|
|
0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x47, 0x69, 0x74, 0x43,
|
|
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x45, 0x6e,
|
|
0x74, 0x72, 0x79, 0x52, 0x08, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x12, 0x40, 0x0a,
|
|
0x0a, 0x73, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28,
|
|
0x0b, 0x32, 0x20, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x47, 0x69, 0x74, 0x43, 0x6f, 0x6e,
|
|
0x66, 0x69, 0x67, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x45, 0x6e,
|
|
0x74, 0x72, 0x79, 0x52, 0x0a, 0x73, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x12,
|
|
0x34, 0x0a, 0x06, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
|
0x1c, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x47, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69,
|
|
0x67, 0x2e, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x68,
|
|
0x61, 0x73, 0x68, 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x08, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
|
|
0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e,
|
|
0x47, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f,
|
|
0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
|
|
0x73, 0x12, 0x26, 0x0a, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b,
|
|
0x32, 0x10, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x47, 0x69, 0x74, 0x42, 0x72, 0x61, 0x6e,
|
|
0x63, 0x68, 0x52, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x1a, 0x37, 0x0a, 0x09, 0x43, 0x6f, 0x72,
|
|
0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20,
|
|
0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
|
|
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02,
|
|
0x38, 0x01, 0x1a, 0x4c, 0x0a, 0x0c, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74,
|
|
0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
|
0x03, 0x6b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20,
|
|
0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x47, 0x69, 0x74, 0x52,
|
|
0x65, 0x6d, 0x6f, 0x74, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,
|
|
0x1a, 0x4d, 0x0a, 0x0d, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72,
|
|
0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
|
|
0x6b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,
|
|
0x28, 0x0b, 0x32, 0x10, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x47, 0x69, 0x74, 0x42, 0x72,
|
|
0x61, 0x6e, 0x63, 0x68, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a,
|
|
0x3d, 0x0a, 0x0f, 0x53, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x45, 0x6e, 0x74,
|
|
0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
|
0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20,
|
|
0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39,
|
|
0x0a, 0x0b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
|
|
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
|
|
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
|
|
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x56, 0x65, 0x72,
|
|
0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
|
|
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05,
|
|
0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c,
|
|
0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xca, 0x01, 0x0a, 0x06, 0x47, 0x69, 0x74, 0x54, 0x61,
|
|
0x67, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x66, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
|
|
0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x66, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3c, 0x0a, 0x0b, 0x63,
|
|
0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x64, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
|
|
0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
|
0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0b, 0x63, 0x72,
|
|
0x65, 0x61, 0x74, 0x6f, 0x72, 0x64, 0x61, 0x74, 0x65, 0x12, 0x3a, 0x0a, 0x0a, 0x61, 0x75, 0x74,
|
|
0x68, 0x6f, 0x72, 0x64, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
|
|
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
|
|
0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f,
|
|
0x72, 0x64, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20,
|
|
0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62,
|
|
0x6a, 0x65, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a,
|
|
0x65, 0x63, 0x74, 0x22, 0x60, 0x0a, 0x07, 0x47, 0x69, 0x74, 0x54, 0x61, 0x67, 0x73, 0x12, 0x12,
|
|
0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75,
|
|
0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20,
|
|
0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x07,
|
|
0x67, 0x69, 0x74, 0x54, 0x61, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e,
|
|
0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x47, 0x69, 0x74, 0x54, 0x61, 0x67, 0x52, 0x07, 0x67, 0x69,
|
|
0x74, 0x54, 0x61, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
}
|
|
|
|
var (
|
|
file_gitTag_proto_rawDescOnce sync.Once
|
|
file_gitTag_proto_rawDescData = file_gitTag_proto_rawDesc
|
|
)
|
|
|
|
func file_gitTag_proto_rawDescGZIP() []byte {
|
|
file_gitTag_proto_rawDescOnce.Do(func() {
|
|
file_gitTag_proto_rawDescData = protoimpl.X.CompressGZIP(file_gitTag_proto_rawDescData)
|
|
})
|
|
return file_gitTag_proto_rawDescData
|
|
}
|
|
|
|
var file_gitTag_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
|
|
var file_gitTag_proto_goTypes = []any{
|
|
(*GitRemote)(nil), // 0: gitpb.GitRemote
|
|
(*GitBranch)(nil), // 1: gitpb.GitBranch
|
|
(*GitConfig)(nil), // 2: gitpb.GitConfig
|
|
(*GitTag)(nil), // 3: gitpb.GitTag
|
|
(*GitTags)(nil), // 4: gitpb.GitTags
|
|
nil, // 5: gitpb.GitConfig.CoreEntry
|
|
nil, // 6: gitpb.GitConfig.RemotesEntry
|
|
nil, // 7: gitpb.GitConfig.BranchesEntry
|
|
nil, // 8: gitpb.GitConfig.SubmodulesEntry
|
|
nil, // 9: gitpb.GitConfig.HashesEntry
|
|
nil, // 10: gitpb.GitConfig.VersionsEntry
|
|
(*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp
|
|
}
|
|
var file_gitTag_proto_depIdxs = []int32{
|
|
5, // 0: gitpb.GitConfig.core:type_name -> gitpb.GitConfig.CoreEntry
|
|
6, // 1: gitpb.GitConfig.remotes:type_name -> gitpb.GitConfig.RemotesEntry
|
|
7, // 2: gitpb.GitConfig.branches:type_name -> gitpb.GitConfig.BranchesEntry
|
|
8, // 3: gitpb.GitConfig.submodules:type_name -> gitpb.GitConfig.SubmodulesEntry
|
|
9, // 4: gitpb.GitConfig.hashes:type_name -> gitpb.GitConfig.HashesEntry
|
|
10, // 5: gitpb.GitConfig.versions:type_name -> gitpb.GitConfig.VersionsEntry
|
|
1, // 6: gitpb.GitConfig.local:type_name -> gitpb.GitBranch
|
|
11, // 7: gitpb.GitTag.creatordate:type_name -> google.protobuf.Timestamp
|
|
11, // 8: gitpb.GitTag.authordate:type_name -> google.protobuf.Timestamp
|
|
3, // 9: gitpb.GitTags.gitTags:type_name -> gitpb.GitTag
|
|
0, // 10: gitpb.GitConfig.RemotesEntry.value:type_name -> gitpb.GitRemote
|
|
1, // 11: gitpb.GitConfig.BranchesEntry.value:type_name -> gitpb.GitBranch
|
|
12, // [12:12] is the sub-list for method output_type
|
|
12, // [12:12] is the sub-list for method input_type
|
|
12, // [12:12] is the sub-list for extension type_name
|
|
12, // [12:12] is the sub-list for extension extendee
|
|
0, // [0:12] is the sub-list for field type_name
|
|
}
|
|
|
|
func init() { file_gitTag_proto_init() }
|
|
func file_gitTag_proto_init() {
|
|
if File_gitTag_proto != nil {
|
|
return
|
|
}
|
|
type x struct{}
|
|
out := protoimpl.TypeBuilder{
|
|
File: protoimpl.DescBuilder{
|
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
|
RawDescriptor: file_gitTag_proto_rawDesc,
|
|
NumEnums: 0,
|
|
NumMessages: 11,
|
|
NumExtensions: 0,
|
|
NumServices: 0,
|
|
},
|
|
GoTypes: file_gitTag_proto_goTypes,
|
|
DependencyIndexes: file_gitTag_proto_depIdxs,
|
|
MessageInfos: file_gitTag_proto_msgTypes,
|
|
}.Build()
|
|
File_gitTag_proto = out.File
|
|
file_gitTag_proto_rawDesc = nil
|
|
file_gitTag_proto_goTypes = nil
|
|
file_gitTag_proto_depIdxs = nil
|
|
}
|
|
|
|
// `autogen:gitTag.sort.pb.go`
|
|
|
|
// Code generated by go.wit.com/apps/autogenpb DO NOT EDIT.
|
|
// This file was autogenerated with autogenpb v0.0.49-2-g9a0e4a6 2025.02.01_0732
|
|
// go install go.wit.com/apps/autogenpb@latest
|
|
//
|
|
// define which structs (messages) you want to use in the .proto file
|
|
// Then sort.pb.go and marshal.pb.go files are autogenerated
|
|
//
|
|
// autogenpb uses it and has an example .proto file with instructions
|
|
//
|
|
|
|
package gitpb
|
|
|
|
import (
|
|
"fmt"
|
|
"sort"
|
|
"sync"
|
|
)
|
|
|
|
// a simple global lock
|
|
var gitTagMu sync.RWMutex
|
|
|
|
func (x *GitTags) fixUuid() {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Uuid == "ffdff813-0316-4372-9e82-4c1c7d202526" {
|
|
return
|
|
}
|
|
x.Uuid = "ffdff813-0316-4372-9e82-4c1c7d202526"
|
|
x.Version = "v0.0.47 go.wit.com/lib/protobuf/gitpb"
|
|
}
|
|
|
|
func NewGitTags() *GitTags {
|
|
x := new(GitTags)
|
|
x.Uuid = "ffdff813-0316-4372-9e82-4c1c7d202526"
|
|
x.Version = "v0.0.47 go.wit.com/lib/protobuf/gitpb"
|
|
return x
|
|
}
|
|
|
|
// START SORT
|
|
|
|
// DEFINE THE GitTags ITERATOR.
|
|
// itializes a new iterator.
|
|
func newGitTagsIterator(things []*GitTags) *GitTagsIterator {
|
|
return &GitTagsIterator{things: things}
|
|
}
|
|
|
|
type GitTagsIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*GitTags
|
|
index int
|
|
}
|
|
|
|
func (it *GitTagsIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *GitTagsIterator) Next() *GitTags {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in GitTagsIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// DEFINE THE GitTag ITERATOR.
|
|
// itializes a new iterator.
|
|
func newGitTagIterator(things []*GitTag) *GitTagIterator {
|
|
return &GitTagIterator{things: things}
|
|
}
|
|
|
|
type GitTagIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*GitTag
|
|
index int
|
|
}
|
|
|
|
func (it *GitTagIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *GitTagIterator) Next() *GitTag {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in GitTagIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// DEFINE THE GitRemote ITERATOR.
|
|
// itializes a new iterator.
|
|
func newGitRemoteIterator(things []*GitRemote) *GitRemoteIterator {
|
|
return &GitRemoteIterator{things: things}
|
|
}
|
|
|
|
type GitRemoteIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*GitRemote
|
|
index int
|
|
}
|
|
|
|
func (it *GitRemoteIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *GitRemoteIterator) Next() *GitRemote {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in GitRemoteIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// DEFINE THE GitBranch ITERATOR.
|
|
// itializes a new iterator.
|
|
func newGitBranchIterator(things []*GitBranch) *GitBranchIterator {
|
|
return &GitBranchIterator{things: things}
|
|
}
|
|
|
|
type GitBranchIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*GitBranch
|
|
index int
|
|
}
|
|
|
|
func (it *GitBranchIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *GitBranchIterator) Next() *GitBranch {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in GitBranchIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// DEFINE THE GitConfig ITERATOR.
|
|
// itializes a new iterator.
|
|
func newGitConfigIterator(things []*GitConfig) *GitConfigIterator {
|
|
return &GitConfigIterator{things: things}
|
|
}
|
|
|
|
type GitConfigIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*GitConfig
|
|
index int
|
|
}
|
|
|
|
func (it *GitConfigIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *GitConfigIterator) Next() *GitConfig {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in GitConfigIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// sort struct by Refname
|
|
type GitTagRefname []*GitTag
|
|
|
|
func (a GitTagRefname) Len() int { return len(a) }
|
|
func (a GitTagRefname) Less(i, j int) bool { return a[i].Refname < a[j].Refname }
|
|
func (a GitTagRefname) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
|
|
|
// safely returns a slice of pointers to the FRUIT protobufs
|
|
func (x *GitTags) allGitTags() []*GitTag {
|
|
gitTagMu.RLock()
|
|
defer gitTagMu.RUnlock()
|
|
|
|
// Create a new slice to hold pointers to each FRUIT
|
|
var tmp []*GitTag
|
|
tmp = make([]*GitTag, len(x.GitTags))
|
|
for i, p := range x.GitTags {
|
|
tmp[i] = p // Copy pointers for safe iteration
|
|
}
|
|
|
|
return tmp
|
|
}
|
|
|
|
// safely returns a slice of pointers to the FRUIT protobufs
|
|
func (x *GitConfig) allLocal() []*GitBranch {
|
|
gitTagMu.RLock()
|
|
defer gitTagMu.RUnlock()
|
|
|
|
// Create a new slice to hold pointers to each FRUIT
|
|
var tmp []*GitBranch
|
|
tmp = make([]*GitBranch, len(x.Local))
|
|
for i, p := range x.Local {
|
|
tmp[i] = p // Copy pointers for safe iteration
|
|
}
|
|
|
|
return tmp
|
|
}
|
|
|
|
// safely returns a slice of pointers to the GitTag protobufs
|
|
func (x *GitTags) selectAllGitTags() []*GitTag {
|
|
gitTagMu.RLock()
|
|
defer gitTagMu.RUnlock()
|
|
|
|
// Create a new slice to hold pointers to each GitTag
|
|
var tmp []*GitTag
|
|
tmp = make([]*GitTag, len(x.GitTags))
|
|
for i, p := range x.GitTags {
|
|
tmp[i] = p // Copy pointers for safe iteration
|
|
}
|
|
|
|
return tmp
|
|
}
|
|
|
|
// safely returns a slice of pointers to the GitBranch protobufs
|
|
func (x *GitConfig) selectAllLocal() []*GitBranch {
|
|
gitTagMu.RLock()
|
|
defer gitTagMu.RUnlock()
|
|
|
|
// Create a new slice to hold pointers to each GitBranch
|
|
var tmp []*GitBranch
|
|
tmp = make([]*GitBranch, len(x.Local))
|
|
for i, p := range x.Local {
|
|
tmp[i] = p // Copy pointers for safe iteration
|
|
}
|
|
|
|
return tmp
|
|
}
|
|
func (x *GitTags) SortByRefname() *GitTagIterator {
|
|
// copy the pointers as fast as possible.
|
|
things := x.selectAllGitTags()
|
|
|
|
// todo: try slices.SortFunc() instead to see what happens
|
|
sort.Sort(GitTagRefname(things))
|
|
// slices.SortFunc(things, func(a, b *GitTags) bool {
|
|
// return a.Refname < b.Refname // Sort by ??. let the compiler work it out??
|
|
// })
|
|
return newGitTagIterator(things)
|
|
}
|
|
|
|
// END SORT
|
|
|
|
func (x *GitTags) Len() int {
|
|
gitTagMu.RLock()
|
|
defer gitTagMu.RUnlock()
|
|
|
|
return len(x.GitTags)
|
|
}
|
|
|
|
// just a simple Append() shortcut (but still uses the mutex lock)
|
|
func (x *GitTags) Append(y *GitTag) {
|
|
gitTagMu.Lock()
|
|
defer gitTagMu.Unlock()
|
|
|
|
x.GitTags = append(x.GitTags, y)
|
|
}
|
|
|
|
func (x *GitTags) All() *GitTagIterator {
|
|
GitTagPointers := x.selectAllGitTags()
|
|
|
|
iterator := newGitTagIterator(GitTagPointers)
|
|
return iterator
|
|
}
|
|
|
|
func (x *GitTags) Delete(y *GitTag) bool {
|
|
gitTagMu.Lock()
|
|
defer gitTagMu.Unlock()
|
|
|
|
for i, _ := range x.GitTags {
|
|
if x.GitTags[i] == y {
|
|
x.GitTags[i] = x.GitTags[len(x.GitTags)-1]
|
|
x.GitTags = x.GitTags[:len(x.GitTags)-1]
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// lookup a GitTags by the Refname
|
|
func (x *GitTags) FindByRefname(s string) *GitTag {
|
|
if x == nil {
|
|
return nil
|
|
}
|
|
|
|
gitTagMu.RLock()
|
|
defer gitTagMu.RUnlock()
|
|
|
|
for i, _ := range x.GitTags {
|
|
if x.GitTags[i].Refname == s {
|
|
return x.GitTags[i]
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// lookup a GitTags by the Hash
|
|
func (x *GitTags) FindByHash(s string) *GitTag {
|
|
if x == nil {
|
|
return nil
|
|
}
|
|
|
|
gitTagMu.RLock()
|
|
defer gitTagMu.RUnlock()
|
|
|
|
for i, _ := range x.GitTags {
|
|
if x.GitTags[i].Hash == s {
|
|
return x.GitTags[i]
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *GitTags) DeleteByRefname(s string) bool {
|
|
gitTagMu.Lock()
|
|
defer gitTagMu.Unlock()
|
|
|
|
for i, _ := range x.GitTags {
|
|
if x.GitTags[i].Refname == s {
|
|
x.GitTags[i] = x.GitTags[len(x.GitTags)-1]
|
|
x.GitTags = x.GitTags[:len(x.GitTags)-1]
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (x *GitTags) DeleteByHash(s string) bool {
|
|
gitTagMu.Lock()
|
|
defer gitTagMu.Unlock()
|
|
|
|
for i, _ := range x.GitTags {
|
|
if x.GitTags[i].Hash == s {
|
|
x.GitTags[i] = x.GitTags[len(x.GitTags)-1]
|
|
x.GitTags = x.GitTags[:len(x.GitTags)-1]
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (x *GitTags) AppendByRefname(y *GitTag) bool {
|
|
gitTagMu.Lock()
|
|
defer gitTagMu.Unlock()
|
|
|
|
for _, p := range x.GitTags {
|
|
if p.Refname == y.Refname {
|
|
return false
|
|
}
|
|
}
|
|
|
|
x.GitTags = append(x.GitTags, y)
|
|
return true
|
|
}
|
|
|
|
func (x *GitTags) AppendByHash(y *GitTag) bool {
|
|
gitTagMu.Lock()
|
|
defer gitTagMu.Unlock()
|
|
|
|
for _, p := range x.GitTags {
|
|
if p.Hash == y.Hash {
|
|
return false
|
|
}
|
|
}
|
|
|
|
x.GitTags = append(x.GitTags, y)
|
|
return true
|
|
}
|
|
|
|
// `autogen:goDep.marshal.pb.go`
|