parent
3c60121ca7
commit
4c67925531
7 changed files with 53 additions and 75 deletions
2
vendor/code.gitea.io/git/MAINTAINERS
generated
vendored
2
vendor/code.gitea.io/git/MAINTAINERS
generated
vendored
|
@ -15,3 +15,5 @@ Thomas Boerger <thomas@webhippie.de> (@tboerger)
|
||||||
Lauris Bukšis-Haberkorns <lauris@nix.lv> (@lafriks)
|
Lauris Bukšis-Haberkorns <lauris@nix.lv> (@lafriks)
|
||||||
Antoine Girard <sapk@sapk.fr> (@sapk)
|
Antoine Girard <sapk@sapk.fr> (@sapk)
|
||||||
Jonas Östanbäck <jonas.ostanback@gmail.com> (@cez81)
|
Jonas Östanbäck <jonas.ostanback@gmail.com> (@cez81)
|
||||||
|
David Schneiderbauer <dschneiderbauer@gmail.com> (@daviian)
|
||||||
|
Peter Žeby <morlinest@gmail.com> (@morlinest)
|
||||||
|
|
11
vendor/code.gitea.io/git/commit.go
generated
vendored
11
vendor/code.gitea.io/git/commit.go
generated
vendored
|
@ -12,8 +12,6 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/mcuadros/go-version"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Commit represents a git commit.
|
// Commit represents a git commit.
|
||||||
|
@ -160,13 +158,7 @@ func CommitChanges(repoPath string, opts CommitChangesOptions) error {
|
||||||
|
|
||||||
func commitsCount(repoPath, revision, relpath string) (int64, error) {
|
func commitsCount(repoPath, revision, relpath string) (int64, error) {
|
||||||
var cmd *Command
|
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)
|
cmd.AddArguments(revision)
|
||||||
if len(relpath) > 0 {
|
if len(relpath) > 0 {
|
||||||
cmd.AddArguments("--", relpath)
|
cmd.AddArguments("--", relpath)
|
||||||
|
@ -177,9 +169,6 @@ func commitsCount(repoPath, revision, relpath string) (int64, error) {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if isFallback {
|
|
||||||
return int64(strings.Count(stdout, "\n")) + 1, nil
|
|
||||||
}
|
|
||||||
return strconv.ParseInt(strings.TrimSpace(stdout), 10, 64)
|
return strconv.ParseInt(strings.TrimSpace(stdout), 10, 64)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
6
vendor/code.gitea.io/git/repo_branch.go
generated
vendored
6
vendor/code.gitea.io/git/repo_branch.go
generated
vendored
|
@ -7,8 +7,6 @@ package git
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/mcuadros/go-version"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// BranchPrefix base dir of the branch information file store on git
|
// 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.
|
// SetDefaultBranch sets default branch of repository.
|
||||||
func (repo *Repository) SetDefaultBranch(name string) error {
|
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)
|
_, err := NewCommand("symbolic-ref", "HEAD", BranchPrefix+name).RunInDir(repo.Path)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
28
vendor/code.gitea.io/git/repo_commit.go
generated
vendored
28
vendor/code.gitea.io/git/repo_commit.go
generated
vendored
|
@ -10,8 +10,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/mcuadros/go-version"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// getRefCommitID returns the last commit ID string of given reference (branch or tag).
|
// 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).
|
// CommitsBetween returns a list that contains commits between [last, before).
|
||||||
func (repo *Repository) CommitsBetween(last *Commit, before *Commit) (*list.List, error) {
|
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)
|
stdout, err := NewCommand("rev-list", before.ID.String()+"..."+last.ID.String()).RunInDirBytes(repo.Path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return repo.parsePrettyFormatLogToList(bytes.TrimSpace(stdout))
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return l, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CommitsBetweenIDs return commits between twoe commits
|
// CommitsBetweenIDs return commits between twoe commits
|
||||||
|
|
5
vendor/code.gitea.io/git/signature.go
generated
vendored
5
vendor/code.gitea.io/git/signature.go
generated
vendored
|
@ -32,6 +32,7 @@ func newSignatureFromCommitline(line []byte) (_ *Signature, err error) {
|
||||||
sig.Email = string(line[emailStart+1 : emailEnd])
|
sig.Email = string(line[emailStart+1 : emailEnd])
|
||||||
|
|
||||||
// Check date format.
|
// Check date format.
|
||||||
|
if len(line) > emailEnd+2 {
|
||||||
firstChar := line[emailEnd+2]
|
firstChar := line[emailEnd+2]
|
||||||
if firstChar >= 48 && firstChar <= 57 {
|
if firstChar >= 48 && firstChar <= 57 {
|
||||||
timestop := bytes.IndexByte(line[emailEnd+2:], ' ')
|
timestop := bytes.IndexByte(line[emailEnd+2:], ' ')
|
||||||
|
@ -44,5 +45,9 @@ func newSignatureFromCommitline(line []byte) (_ *Signature, err error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Fall back to unix 0 time
|
||||||
|
sig.When = time.Unix(0, 0)
|
||||||
|
}
|
||||||
return sig, nil
|
return sig, nil
|
||||||
}
|
}
|
||||||
|
|
40
vendor/code.gitea.io/git/tree_entry.go
generated
vendored
40
vendor/code.gitea.io/git/tree_entry.go
generated
vendored
|
@ -116,35 +116,51 @@ func (te *TreeEntry) GetSubJumpablePathName() string {
|
||||||
// Entries a list of entry
|
// Entries a list of entry
|
||||||
type Entries []*TreeEntry
|
type Entries []*TreeEntry
|
||||||
|
|
||||||
var sorter = []func(t1, t2 *TreeEntry) bool{
|
type customSortableEntries struct {
|
||||||
func(t1, t2 *TreeEntry) bool {
|
Comparer func(s1, s2 string) bool
|
||||||
|
Entries
|
||||||
|
}
|
||||||
|
|
||||||
|
var sorter = []func(t1, t2 *TreeEntry, cmp func(s1, s2 string) bool) bool{
|
||||||
|
func(t1, t2 *TreeEntry, cmp func(s1, s2 string) bool) bool {
|
||||||
return (t1.IsDir() || t1.IsSubModule()) && !t2.IsDir() && !t2.IsSubModule()
|
return (t1.IsDir() || t1.IsSubModule()) && !t2.IsDir() && !t2.IsSubModule()
|
||||||
},
|
},
|
||||||
func(t1, t2 *TreeEntry) bool {
|
func(t1, t2 *TreeEntry, cmp func(s1, s2 string) bool) bool {
|
||||||
return t1.name < t2.name
|
return cmp(t1.name, t2.name)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tes Entries) Len() int { return len(tes) }
|
func (ctes customSortableEntries) Len() int { return len(ctes.Entries) }
|
||||||
func (tes Entries) Swap(i, j int) { tes[i], tes[j] = tes[j], tes[i] }
|
|
||||||
func (tes Entries) Less(i, j int) bool {
|
func (ctes customSortableEntries) Swap(i, j int) {
|
||||||
t1, t2 := tes[i], tes[j]
|
ctes.Entries[i], ctes.Entries[j] = ctes.Entries[j], ctes.Entries[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ctes customSortableEntries) Less(i, j int) bool {
|
||||||
|
t1, t2 := ctes.Entries[i], ctes.Entries[j]
|
||||||
var k int
|
var k int
|
||||||
for k = 0; k < len(sorter)-1; k++ {
|
for k = 0; k < len(sorter)-1; k++ {
|
||||||
s := sorter[k]
|
s := sorter[k]
|
||||||
switch {
|
switch {
|
||||||
case s(t1, t2):
|
case s(t1, t2, ctes.Comparer):
|
||||||
return true
|
return true
|
||||||
case s(t2, t1):
|
case s(t2, t1, ctes.Comparer):
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sorter[k](t1, t2)
|
return sorter[k](t1, t2, ctes.Comparer)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort sort the list of entry
|
// Sort sort the list of entry
|
||||||
func (tes Entries) Sort() {
|
func (tes Entries) Sort() {
|
||||||
sort.Sort(tes)
|
sort.Sort(customSortableEntries{func(s1, s2 string) bool {
|
||||||
|
return s1 < s2
|
||||||
|
}, tes})
|
||||||
|
}
|
||||||
|
|
||||||
|
// CustomSort customizable string comparing sort entry list
|
||||||
|
func (tes Entries) CustomSort(cmp func(s1, s2 string) bool) {
|
||||||
|
sort.Sort(customSortableEntries{cmp, tes})
|
||||||
}
|
}
|
||||||
|
|
||||||
type commitInfo struct {
|
type commitInfo struct {
|
||||||
|
|
6
vendor/vendor.json
vendored
6
vendor/vendor.json
vendored
|
@ -3,10 +3,10 @@
|
||||||
"ignore": "test appengine",
|
"ignore": "test appengine",
|
||||||
"package": [
|
"package": [
|
||||||
{
|
{
|
||||||
"checksumSHA1": "fR5YDSoG7xYv2aLO23rne95gWps=",
|
"checksumSHA1": "JN/re4+x/hCzMLGHmieUcykVDAg=",
|
||||||
"path": "code.gitea.io/git",
|
"path": "code.gitea.io/git",
|
||||||
"revision": "479f87e5d189e7b8f1fd51dbcd25faa32b632cd2",
|
"revision": "d47b98c44c9a6472e44ab80efe65235e11c6da2a",
|
||||||
"revisionTime": "2017-08-03T00:53:29Z"
|
"revisionTime": "2017-10-23T00:52:09Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "Zgp5RqU+20L2p9TNl1rSsUIWEEE=",
|
"checksumSHA1": "Zgp5RqU+20L2p9TNl1rSsUIWEEE=",
|
||||||
|
|
Reference in a new issue