Skip to content

Commit 20722b9

Browse files
committed
v2: start of a new era
1 parent 0300f96 commit 20722b9

File tree

5 files changed

+5
-56
lines changed

5 files changed

+5
-56
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
# Git Module
22

3-
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/gogs/git-module/Go?logo=github&style=for-the-badge)](https://github.com/gogs/git-module/actions?query=workflow%3AGo)
4-
[![GoDoc](https://img.shields.io/badge/GoDoc-Reference-blue?style=for-the-badge&logo=go)](https://pkg.go.dev/github.com/gogs/git-module?tab=doc)
3+
[![GoDoc](https://img.shields.io/badge/GoDoc-Reference-blue?style=for-the-badge&logo=go)](https://pkg.go.dev/github.com/gogs/git-module/v2?tab=doc)
54

65
Package git-module is a Go module for Git access through shell commands.
76

87
## Requirements
98

10-
- Git version must be no less than **1.8.3**.
11-
- For Windows users, try to use the latest version of both.
9+
- Git version must be no less than **2.4.9**.
1210

1311
## License
1412

git_test.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,11 @@ package git
77
import (
88
"bytes"
99
"flag"
10-
"fmt"
1110
stdlog "log"
1211
"os"
1312
"testing"
1413

15-
goversion "github.com/mcuadros/go-version"
1614
"github.com/stretchr/testify/assert"
17-
"golang.org/x/sync/errgroup"
1815
)
1916

2017
const repoPath = "testdata/testrepo.git"
@@ -88,21 +85,3 @@ func Test_log(t *testing.T) {
8885
})
8986
}
9087
}
91-
92-
func TestBinVersion(t *testing.T) {
93-
g := errgroup.Group{}
94-
for i := 0; i < 30; i++ {
95-
g.Go(func() error {
96-
version, err := BinVersion()
97-
assert.Nil(t, err)
98-
99-
if !goversion.Compare(version, "1.8.3", ">=") {
100-
return fmt.Errorf("version: expected >= 1.8.3 but got %q", version)
101-
}
102-
return nil
103-
})
104-
}
105-
if err := g.Wait(); err != nil {
106-
t.Fatal(err)
107-
}
108-
}

go.mod

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
module github.com/gogs/git-module
1+
module github.com/gogs/git-module/v2
22

33
go 1.24.0
44

5-
require (
6-
github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75
7-
github.com/stretchr/testify v1.11.1
8-
golang.org/x/sync v0.19.0
9-
)
5+
require github.com/stretchr/testify v1.11.1
106

117
require (
128
github.com/davecgh/go-spew v1.1.1 // indirect

go.sum

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
22
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3-
github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75 h1:Pijfgr7ZuvX7QIQiEwLdRVr3RoMG+i0SbBO1Qu+7yVk=
4-
github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75/go.mod h1:76rfSfYPWj01Z85hUf/ituArm797mNKcvINh1OlsZKo=
53
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
64
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
75
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
86
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
9-
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
10-
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
117
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
128
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
139
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

repo_tag.go

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import (
99
"fmt"
1010
"strings"
1111
"time"
12-
13-
goversion "github.com/mcuadros/go-version"
1412
)
1513

1614
// parseTag parses tag information from the (uncompressed) raw data of the tag
@@ -168,20 +166,12 @@ func RepoTags(repoPath string, opts ...TagsOptions) ([]string, error) {
168166
opt = opts[0]
169167
}
170168

171-
version, err := BinVersion()
172-
if err != nil {
173-
return nil, err
174-
}
175-
176169
cmd := NewCommand("tag", "--list").AddOptions(opt.CommandOptions)
177170

178-
var sorted bool
179171
if opt.SortKey != "" {
180172
cmd.AddArgs("--sort=" + opt.SortKey)
181-
sorted = true
182-
} else if goversion.Compare(version, "2.4.9", ">=") {
173+
} else {
183174
cmd.AddArgs("--sort=-creatordate")
184-
sorted = true
185175
}
186176

187177
if opt.Pattern != "" {
@@ -196,16 +186,6 @@ func RepoTags(repoPath string, opts ...TagsOptions) ([]string, error) {
196186
tags := strings.Split(string(stdout), "\n")
197187
tags = tags[:len(tags)-1]
198188

199-
if !sorted {
200-
goversion.Sort(tags)
201-
202-
// Reverse order
203-
for i := 0; i < len(tags)/2; i++ {
204-
j := len(tags) - i - 1
205-
tags[i], tags[j] = tags[j], tags[i]
206-
}
207-
}
208-
209189
return tags, nil
210190
}
211191

0 commit comments

Comments
 (0)