Browse Source

Update vendor git (#2765)

Lauris BH 2 years ago
parent
commit
9ba7898911

+ 2 - 0
vendor/code.gitea.io/git/MAINTAINERS

@@ -15,3 +15,5 @@ Thomas Boerger <thomas@webhippie.de> (@tboerger)
15 15
 Lauris Bukšis-Haberkorns <lauris@nix.lv> (@lafriks)
16 16
 Antoine Girard <sapk@sapk.fr> (@sapk)
17 17
 Jonas Östanbäck <jonas.ostanback@gmail.com> (@cez81)
18
+David Schneiderbauer <dschneiderbauer@gmail.com> (@daviian)
19
+Peter Žeby <morlinest@gmail.com> (@morlinest)

+ 1 - 12
vendor/code.gitea.io/git/commit.go

@@ -12,8 +12,6 @@ import (
12 12
 	"net/http"
13 13
 	"strconv"
14 14
 	"strings"
15
-
16
-	"github.com/mcuadros/go-version"
17 15
 )
18 16
 
19 17
 // Commit represents a git commit.
@@ -160,13 +158,7 @@ func CommitChanges(repoPath string, opts CommitChangesOptions) error {
160 158
 
161 159
 func commitsCount(repoPath, revision, relpath string) (int64, error) {
162 160
 	var cmd *Command
163
-	isFallback := false
164
-	if version.Compare(gitVersion, "1.8.0", "<") {
165
-		isFallback = true
166
-		cmd = NewCommand("log", "--pretty=format:''")
167
-	} else {
168
-		cmd = NewCommand("rev-list", "--count")
169
-	}
161
+	cmd = NewCommand("rev-list", "--count")
170 162
 	cmd.AddArguments(revision)
171 163
 	if len(relpath) > 0 {
172 164
 		cmd.AddArguments("--", relpath)
@@ -177,9 +169,6 @@ func commitsCount(repoPath, revision, relpath string) (int64, error) {
177 169
 		return 0, err
178 170
 	}
179 171
 
180
-	if isFallback {
181
-		return int64(strings.Count(stdout, "\n")) + 1, nil
182
-	}
183 172
 	return strconv.ParseInt(strings.TrimSpace(stdout), 10, 64)
184 173
 }
185 174
 

+ 0 - 6
vendor/code.gitea.io/git/repo_branch.go

@@ -7,8 +7,6 @@ package git
7 7
 import (
8 8
 	"fmt"
9 9
 	"strings"
10
-
11
-	"github.com/mcuadros/go-version"
12 10
 )
13 11
 
14 12
 // BranchPrefix base dir of the branch information file store on git
@@ -56,10 +54,6 @@ func (repo *Repository) GetHEADBranch() (*Branch, error) {
56 54
 
57 55
 // SetDefaultBranch sets default branch of repository.
58 56
 func (repo *Repository) SetDefaultBranch(name string) error {
59
-	if version.Compare(gitVersion, "1.7.10", "<") {
60
-		return ErrUnsupportedVersion{"1.7.10"}
61
-	}
62
-
63 57
 	_, err := NewCommand("symbolic-ref", "HEAD", BranchPrefix+name).RunInDir(repo.Path)
64 58
 	return err
65 59
 }

+ 4 - 32
vendor/code.gitea.io/git/repo_commit.go

@@ -10,8 +10,6 @@ import (
10 10
 	"fmt"
11 11
 	"strconv"
12 12
 	"strings"
13
-
14
-	"github.com/mcuadros/go-version"
15 13
 )
16 14
 
17 15
 // getRefCommitID returns the last commit ID string of given reference (branch or tag).
@@ -248,37 +246,11 @@ func (repo *Repository) FilesCountBetween(startCommitID, endCommitID string) (in
248 246
 
249 247
 // CommitsBetween returns a list that contains commits between [last, before).
250 248
 func (repo *Repository) CommitsBetween(last *Commit, before *Commit) (*list.List, error) {
251
-	if version.Compare(gitVersion, "1.8.0", ">=") {
252
-		stdout, err := NewCommand("rev-list", before.ID.String()+"..."+last.ID.String()).RunInDirBytes(repo.Path)
253
-		if err != nil {
254
-			return nil, err
255
-		}
256
-		return repo.parsePrettyFormatLogToList(bytes.TrimSpace(stdout))
257
-	}
258
-
259
-	// Fallback to stupid solution, which iterates all commits of the repository
260
-	// if before is not an ancestor of last.
261
-	l := list.New()
262
-	if last == nil || last.ParentCount() == 0 {
263
-		return l, nil
264
-	}
265
-
266
-	var err error
267
-	cur := last
268
-	for {
269
-		if cur.ID.Equal(before.ID) {
270
-			break
271
-		}
272
-		l.PushBack(cur)
273
-		if cur.ParentCount() == 0 {
274
-			break
275
-		}
276
-		cur, err = cur.Parent(0)
277
-		if err != nil {
278
-			return nil, err
279
-		}
249
+	stdout, err := NewCommand("rev-list", before.ID.String()+"..."+last.ID.String()).RunInDirBytes(repo.Path)
250
+	if err != nil {
251
+		return nil, err
280 252
 	}
281
-	return l, nil
253
+	return repo.parsePrettyFormatLogToList(bytes.TrimSpace(stdout))
282 254
 }
283 255
 
284 256
 // CommitsBetweenIDs return commits between twoe commits

+ 15 - 10
vendor/code.gitea.io/git/signature.go

@@ -32,17 +32,22 @@ func newSignatureFromCommitline(line []byte) (_ *Signature, err error) {
32 32
 	sig.Email = string(line[emailStart+1 : emailEnd])
33 33
 
34 34
 	// Check date format.
35
-	firstChar := line[emailEnd+2]
36
-	if firstChar >= 48 && firstChar <= 57 {
37
-		timestop := bytes.IndexByte(line[emailEnd+2:], ' ')
38
-		timestring := string(line[emailEnd+2 : emailEnd+2+timestop])
39
-		seconds, _ := strconv.ParseInt(timestring, 10, 64)
40
-		sig.When = time.Unix(seconds, 0)
41
-	} else {
42
-		sig.When, err = time.Parse("Mon Jan _2 15:04:05 2006 -0700", string(line[emailEnd+2:]))
43
-		if err != nil {
44
-			return nil, err
35
+	if len(line) > emailEnd+2 {
36
+		firstChar := line[emailEnd+2]
37
+		if firstChar >= 48 && firstChar <= 57 {
38
+			timestop := bytes.IndexByte(line[emailEnd+2:], ' ')
39
+			timestring := string(line[emailEnd+2 : emailEnd+2+timestop])
40
+			seconds, _ := strconv.ParseInt(timestring, 10, 64)
41
+			sig.When = time.Unix(seconds, 0)
42
+		} else {
43
+			sig.When, err = time.Parse("Mon Jan _2 15:04:05 2006 -0700", string(line[emailEnd+2:]))
44
+			if err != nil {
45
+				return nil, err
46
+			}
45 47
 		}
48
+	} else {
49
+		// Fall back to unix 0 time
50
+		sig.When = time.Unix(0, 0)
46 51
 	}
47 52
 	return sig, nil
48 53
 }

+ 3 - 3
vendor/vendor.json

@@ -3,10 +3,10 @@
3 3
 	"ignore": "test appengine",
4 4
 	"package": [
5 5
 		{
6
-			"checksumSHA1": "9dxw/SGpdhNNm704gt6F02ItYtQ=",
6
+			"checksumSHA1": "JN/re4+x/hCzMLGHmieUcykVDAg=",
7 7
 			"path": "code.gitea.io/git",
8
-			"revision": "d7487da878e40ee6c4fac7280b518c0ed0be702c",
9
-			"revisionTime": "2017-09-16T17:49:37Z"
8
+			"revision": "d47b98c44c9a6472e44ab80efe65235e11c6da2a",
9
+			"revisionTime": "2017-10-23T00:52:09Z"
10 10
 		},
11 11
 		{
12 12
 			"checksumSHA1": "Zgp5RqU+20L2p9TNl1rSsUIWEEE=",