mirror of
https://github.com/gogs/gogs.git
synced 2025-12-21 15:50:00 +01:00
vendor: update github.com/gogs/git-module
This commit is contained in:
5
vendor/github.com/gogs/git-module/commit.go
generated
vendored
5
vendor/github.com/gogs/git-module/commit.go
generated
vendored
@@ -163,11 +163,6 @@ func commitsCount(repoPath, revision, relpath string) (int64, error) {
|
||||
return strconv.ParseInt(strings.TrimSpace(stdout), 10, 64)
|
||||
}
|
||||
|
||||
// CommitsCount returns number of total commits of until given revision.
|
||||
func CommitsCount(repoPath, revision string) (int64, error) {
|
||||
return commitsCount(repoPath, revision, "")
|
||||
}
|
||||
|
||||
func (c *Commit) CommitsCount() (int64, error) {
|
||||
return CommitsCount(c.repo.Path, c.ID.String())
|
||||
}
|
||||
|
||||
2
vendor/github.com/gogs/git-module/git.go
generated
vendored
2
vendor/github.com/gogs/git-module/git.go
generated
vendored
@@ -10,7 +10,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const _VERSION = "0.6.4"
|
||||
const _VERSION = "0.6.5"
|
||||
|
||||
func Version() string {
|
||||
return _VERSION
|
||||
|
||||
15
vendor/github.com/gogs/git-module/repo.go
generated
vendored
15
vendor/github.com/gogs/git-module/repo.go
generated
vendored
@@ -278,18 +278,3 @@ func GetRepoSize(repoPath string) (*CountObject, error) {
|
||||
|
||||
return countObject, nil
|
||||
}
|
||||
|
||||
// GetLatestCommitDate returns the date of latest commit of repository.
|
||||
// If branch is empty, it returns the latest commit across all branches.
|
||||
func GetLatestCommitDate(repoPath, branch string) (time.Time, error) {
|
||||
cmd := NewCommand("for-each-ref", "--count=1", "--sort=-committerdate", "--format=%(committerdate:iso8601)")
|
||||
if len(branch) > 0 {
|
||||
cmd.AddArguments("refs/heads/" + branch)
|
||||
}
|
||||
stdout, err := cmd.RunInDir(repoPath)
|
||||
if err != nil {
|
||||
return time.Time{}, err
|
||||
}
|
||||
|
||||
return time.Parse("2006-01-02 15:04:05 -0700", strings.TrimSpace(stdout))
|
||||
}
|
||||
|
||||
32
vendor/github.com/gogs/git-module/repo_commit.go
generated
vendored
32
vendor/github.com/gogs/git-module/repo_commit.go
generated
vendored
@@ -10,6 +10,7 @@ import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/mcuadros/go-version"
|
||||
)
|
||||
@@ -379,3 +380,34 @@ func (repo *Repository) getCommitsBeforeLimit(id sha1, num int) (*list.List, err
|
||||
l := list.New()
|
||||
return l, repo.commitsBefore(l, nil, id, 1, num)
|
||||
}
|
||||
|
||||
// CommitsAfterDate returns a list of commits which committed after given date.
|
||||
// The format of date should be in RFC3339.
|
||||
func (repo *Repository) CommitsAfterDate(date string) (*list.List, error) {
|
||||
stdout, err := NewCommand("log", _PRETTY_LOG_FORMAT, "--since="+date).RunInDirBytes(repo.Path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return repo.parsePrettyFormatLogToList(stdout)
|
||||
}
|
||||
|
||||
// CommitsCount returns number of total commits of until given revision.
|
||||
func CommitsCount(repoPath, revision string) (int64, error) {
|
||||
return commitsCount(repoPath, revision, "")
|
||||
}
|
||||
|
||||
// GetLatestCommitDate returns the date of latest commit of repository.
|
||||
// If branch is empty, it returns the latest commit across all branches.
|
||||
func GetLatestCommitDate(repoPath, branch string) (time.Time, error) {
|
||||
cmd := NewCommand("for-each-ref", "--count=1", "--sort=-committerdate", "--format=%(committerdate:iso8601)")
|
||||
if len(branch) > 0 {
|
||||
cmd.AddArguments("refs/heads/" + branch)
|
||||
}
|
||||
stdout, err := cmd.RunInDir(repoPath)
|
||||
if err != nil {
|
||||
return time.Time{}, err
|
||||
}
|
||||
|
||||
return time.Parse("2006-01-02 15:04:05 -0700", strings.TrimSpace(stdout))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user