diff options
author | Lauris BH <lauris@nix.lv> | 2017-10-23 16:36:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-23 16:36:14 +0300 |
commit | 9ba789891165c816741254e73ced26d401358da7 (patch) | |
tree | 60ab5091a6a3a57d790399d725006e5619a641de /vendor/code.gitea.io | |
parent | 81d1e54a49cc61e64608ff2aee055110c7e4f811 (diff) | |
download | gitea-9ba789891165c816741254e73ced26d401358da7.tar.gz gitea-9ba789891165c816741254e73ced26d401358da7.zip |
Update vendor git (#2765)
Diffstat (limited to 'vendor/code.gitea.io')
-rw-r--r-- | vendor/code.gitea.io/git/MAINTAINERS | 2 | ||||
-rw-r--r-- | vendor/code.gitea.io/git/commit.go | 13 | ||||
-rw-r--r-- | vendor/code.gitea.io/git/repo_branch.go | 6 | ||||
-rw-r--r-- | vendor/code.gitea.io/git/repo_commit.go | 36 | ||||
-rw-r--r-- | vendor/code.gitea.io/git/signature.go | 25 |
5 files changed, 22 insertions, 60 deletions
diff --git a/vendor/code.gitea.io/git/MAINTAINERS b/vendor/code.gitea.io/git/MAINTAINERS index fad08cddd0..2ad3f01f5d 100644 --- a/vendor/code.gitea.io/git/MAINTAINERS +++ b/vendor/code.gitea.io/git/MAINTAINERS @@ -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) diff --git a/vendor/code.gitea.io/git/commit.go b/vendor/code.gitea.io/git/commit.go index b24af93d9a..c295412381 100644 --- a/vendor/code.gitea.io/git/commit.go +++ b/vendor/code.gitea.io/git/commit.go @@ -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) } diff --git a/vendor/code.gitea.io/git/repo_branch.go b/vendor/code.gitea.io/git/repo_branch.go index 2cd9659316..3b50eece14 100644 --- a/vendor/code.gitea.io/git/repo_branch.go +++ b/vendor/code.gitea.io/git/repo_branch.go @@ -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 } diff --git a/vendor/code.gitea.io/git/repo_commit.go b/vendor/code.gitea.io/git/repo_commit.go index 64248d0319..371c044c54 100644 --- a/vendor/code.gitea.io/git/repo_commit.go +++ b/vendor/code.gitea.io/git/repo_commit.go @@ -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 diff --git a/vendor/code.gitea.io/git/signature.go b/vendor/code.gitea.io/git/signature.go index 95eb1bbe07..7dc9763b5d 100644 --- a/vendor/code.gitea.io/git/signature.go +++ b/vendor/code.gitea.io/git/signature.go @@ -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 } |