]> source.dussan.org Git - gitea.git/commitdiff
Update vendor git (#2765)
authorLauris BH <lauris@nix.lv>
Mon, 23 Oct 2017 13:36:14 +0000 (16:36 +0300)
committerGitHub <noreply@github.com>
Mon, 23 Oct 2017 13:36:14 +0000 (16:36 +0300)
vendor/code.gitea.io/git/MAINTAINERS
vendor/code.gitea.io/git/commit.go
vendor/code.gitea.io/git/repo_branch.go
vendor/code.gitea.io/git/repo_commit.go
vendor/code.gitea.io/git/signature.go
vendor/vendor.json

index fad08cddd0dd446e0a2342cf6876b5ff9d0c2981..2ad3f01f5dacd9d62086f844ed534b176a36acc1 100644 (file)
@@ -15,3 +15,5 @@ Thomas Boerger <thomas@webhippie.de> (@tboerger)
 Lauris Bukšis-Haberkorns <lauris@nix.lv> (@lafriks)
 Antoine Girard <sapk@sapk.fr> (@sapk)
 Jonas Östanbäck <jonas.ostanback@gmail.com> (@cez81)
+David Schneiderbauer <dschneiderbauer@gmail.com> (@daviian)
+Peter Žeby <morlinest@gmail.com> (@morlinest)
index b24af93d9a73f95ec81d6368069372d1ad035eda..c2954123816e3732ecb18c70935cb000568e23a6 100644 (file)
@@ -12,8 +12,6 @@ import (
        "net/http"
        "strconv"
        "strings"
-
-       "github.com/mcuadros/go-version"
 )
 
 // Commit represents a git commit.
@@ -160,13 +158,7 @@ func CommitChanges(repoPath string, opts CommitChangesOptions) error {
 
 func commitsCount(repoPath, revision, relpath string) (int64, error) {
        var cmd *Command
-       isFallback := false
-       if version.Compare(gitVersion, "1.8.0", "<") {
-               isFallback = true
-               cmd = NewCommand("log", "--pretty=format:''")
-       } else {
-               cmd = NewCommand("rev-list", "--count")
-       }
+       cmd = NewCommand("rev-list", "--count")
        cmd.AddArguments(revision)
        if len(relpath) > 0 {
                cmd.AddArguments("--", relpath)
@@ -177,9 +169,6 @@ func commitsCount(repoPath, revision, relpath string) (int64, error) {
                return 0, err
        }
 
-       if isFallback {
-               return int64(strings.Count(stdout, "\n")) + 1, nil
-       }
        return strconv.ParseInt(strings.TrimSpace(stdout), 10, 64)
 }
 
index 2cd96593164c501aa32833a01a28fa1e77c1f58b..3b50eece14a31abfda7ce5e8e9b7ce83d135111a 100644 (file)
@@ -7,8 +7,6 @@ package git
 import (
        "fmt"
        "strings"
-
-       "github.com/mcuadros/go-version"
 )
 
 // BranchPrefix base dir of the branch information file store on git
@@ -56,10 +54,6 @@ func (repo *Repository) GetHEADBranch() (*Branch, error) {
 
 // SetDefaultBranch sets default branch of repository.
 func (repo *Repository) SetDefaultBranch(name string) error {
-       if version.Compare(gitVersion, "1.7.10", "<") {
-               return ErrUnsupportedVersion{"1.7.10"}
-       }
-
        _, err := NewCommand("symbolic-ref", "HEAD", BranchPrefix+name).RunInDir(repo.Path)
        return err
 }
index 64248d0319cb1461ec236ae64166f46b52f6ada9..371c044c54de2e6fe112b5fd9cc357cfd2adc20f 100644 (file)
@@ -10,8 +10,6 @@ import (
        "fmt"
        "strconv"
        "strings"
-
-       "github.com/mcuadros/go-version"
 )
 
 // 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
 
 // CommitsBetween returns a list that contains commits between [last, before).
 func (repo *Repository) CommitsBetween(last *Commit, before *Commit) (*list.List, error) {
-       if version.Compare(gitVersion, "1.8.0", ">=") {
-               stdout, err := NewCommand("rev-list", before.ID.String()+"..."+last.ID.String()).RunInDirBytes(repo.Path)
-               if err != nil {
-                       return nil, err
-               }
-               return repo.parsePrettyFormatLogToList(bytes.TrimSpace(stdout))
-       }
-
-       // Fallback to stupid solution, which iterates all commits of the repository
-       // if before is not an ancestor of last.
-       l := list.New()
-       if last == nil || last.ParentCount() == 0 {
-               return l, nil
-       }
-
-       var err error
-       cur := last
-       for {
-               if cur.ID.Equal(before.ID) {
-                       break
-               }
-               l.PushBack(cur)
-               if cur.ParentCount() == 0 {
-                       break
-               }
-               cur, err = cur.Parent(0)
-               if err != nil {
-                       return nil, err
-               }
+       stdout, err := NewCommand("rev-list", before.ID.String()+"..."+last.ID.String()).RunInDirBytes(repo.Path)
+       if err != nil {
+               return nil, err
        }
-       return l, nil
+       return repo.parsePrettyFormatLogToList(bytes.TrimSpace(stdout))
 }
 
 // CommitsBetweenIDs return commits between twoe commits
index 95eb1bbe07425815118d31732dea103df0660204..7dc9763b5d4fa20bed8a7554ef8606af6b5bc6df 100644 (file)
@@ -32,17 +32,22 @@ func newSignatureFromCommitline(line []byte) (_ *Signature, err error) {
        sig.Email = string(line[emailStart+1 : emailEnd])
 
        // Check date format.
-       firstChar := line[emailEnd+2]
-       if firstChar >= 48 && firstChar <= 57 {
-               timestop := bytes.IndexByte(line[emailEnd+2:], ' ')
-               timestring := string(line[emailEnd+2 : emailEnd+2+timestop])
-               seconds, _ := strconv.ParseInt(timestring, 10, 64)
-               sig.When = time.Unix(seconds, 0)
-       } else {
-               sig.When, err = time.Parse("Mon Jan _2 15:04:05 2006 -0700", string(line[emailEnd+2:]))
-               if err != nil {
-                       return nil, err
+       if len(line) > emailEnd+2 {
+               firstChar := line[emailEnd+2]
+               if firstChar >= 48 && firstChar <= 57 {
+                       timestop := bytes.IndexByte(line[emailEnd+2:], ' ')
+                       timestring := string(line[emailEnd+2 : emailEnd+2+timestop])
+                       seconds, _ := strconv.ParseInt(timestring, 10, 64)
+                       sig.When = time.Unix(seconds, 0)
+               } else {
+                       sig.When, err = time.Parse("Mon Jan _2 15:04:05 2006 -0700", string(line[emailEnd+2:]))
+                       if err != nil {
+                               return nil, err
+                       }
                }
+       } else {
+               // Fall back to unix 0 time
+               sig.When = time.Unix(0, 0)
        }
        return sig, nil
 }
index 04e2e8e11a98f8da153c8b5c6ae13b082a22044a..df0dcec81474fa0d75dbc25fccbd167eacf32c6e 100644 (file)
@@ -3,10 +3,10 @@
        "ignore": "test appengine",
        "package": [
                {
-                       "checksumSHA1": "9dxw/SGpdhNNm704gt6F02ItYtQ=",
+                       "checksumSHA1": "JN/re4+x/hCzMLGHmieUcykVDAg=",
                        "path": "code.gitea.io/git",
-                       "revision": "d7487da878e40ee6c4fac7280b518c0ed0be702c",
-                       "revisionTime": "2017-09-16T17:49:37Z"
+                       "revision": "d47b98c44c9a6472e44ab80efe65235e11c6da2a",
+                       "revisionTime": "2017-10-23T00:52:09Z"
                },
                {
                        "checksumSHA1": "Zgp5RqU+20L2p9TNl1rSsUIWEEE=",