mirror of
https://github.com/go-gitea/gitea.git
synced 2025-11-03 08:02:36 +09:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d81cf34e37 | ||
|
|
9902317679 | ||
|
|
33e164168f | ||
|
|
f40ba68d57 | ||
|
|
cb0c8b8ae4 | ||
|
|
eba5945d2f | ||
|
|
4c67925531 | ||
|
|
3c60121ca7 |
@@ -1,4 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
## [1.2.2](https://github.com/go-gitea/gitea/releases/tag/v1.2.2) - 2017-10-26
|
||||||
|
* BUGFIXES
|
||||||
|
* Add checks for commits with missing author and time (#2771) (#2785)
|
||||||
|
* Fix sending mail with a non-latin display name (#2559) (#2783)
|
||||||
|
* Sync MaxGitDiffLineCharacters with conf/app.ini (#2779) (#2780)
|
||||||
|
* Update vendor git (#2765) (#2772)
|
||||||
|
* Fix emojify image URL (#2769) (#2773)
|
||||||
|
|
||||||
## [1.2.1](https://github.com/go-gitea/gitea/releases/tag/v1.2.1) - 2017-10-16
|
## [1.2.1](https://github.com/go-gitea/gitea/releases/tag/v1.2.1) - 2017-10-16
|
||||||
* BUGFIXES
|
* BUGFIXES
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ func composeIssueCommentMessage(issue *Issue, doer *User, comment *Comment, tplN
|
|||||||
log.Error(3, "Template: %v", err)
|
log.Error(3, "Template: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := mailer.NewMessageFrom(tos, fmt.Sprintf(`"%s" <%s>`, doer.DisplayName(), setting.MailService.FromEmail), subject, content.String())
|
msg := mailer.NewMessageFrom(tos, doer.DisplayName(), setting.MailService.FromEmail, subject, content.String())
|
||||||
msg.Info = fmt.Sprintf("Subject: %s, %s", subject, info)
|
msg.Info = fmt.Sprintf("Subject: %s, %s", subject, info)
|
||||||
return msg
|
return msg
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"code.gitea.io/git"
|
"code.gitea.io/git"
|
||||||
|
|
||||||
@@ -119,11 +120,24 @@ func pushUpdateAddTag(repo *Repository, gitRepo *git.Repository, tagName string)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Commit: %v", err)
|
return fmt.Errorf("Commit: %v", err)
|
||||||
}
|
}
|
||||||
tagCreatedUnix := commit.Author.When.Unix()
|
|
||||||
|
|
||||||
author, err := GetUserByEmail(commit.Author.Email)
|
sig := tag.Tagger
|
||||||
if err != nil && !IsErrUserNotExist(err) {
|
if sig == nil {
|
||||||
return fmt.Errorf("GetUserByEmail: %v", err)
|
sig = commit.Author
|
||||||
|
}
|
||||||
|
if sig == nil {
|
||||||
|
sig = commit.Committer
|
||||||
|
}
|
||||||
|
|
||||||
|
var author *User
|
||||||
|
var createdAt = time.Unix(1, 0)
|
||||||
|
|
||||||
|
if sig != nil {
|
||||||
|
author, err = GetUserByEmail(sig.Email)
|
||||||
|
if err != nil && !IsErrUserNotExist(err) {
|
||||||
|
return fmt.Errorf("GetUserByEmail: %v", err)
|
||||||
|
}
|
||||||
|
createdAt = sig.When
|
||||||
}
|
}
|
||||||
|
|
||||||
commitsCount, err := commit.CommitsCount()
|
commitsCount, err := commit.CommitsCount()
|
||||||
@@ -144,7 +158,8 @@ func pushUpdateAddTag(repo *Repository, gitRepo *git.Repository, tagName string)
|
|||||||
IsDraft: false,
|
IsDraft: false,
|
||||||
IsPrerelease: false,
|
IsPrerelease: false,
|
||||||
IsTag: true,
|
IsTag: true,
|
||||||
CreatedUnix: tagCreatedUnix,
|
Created: createdAt,
|
||||||
|
CreatedUnix: createdAt.Unix(),
|
||||||
}
|
}
|
||||||
if author != nil {
|
if author != nil {
|
||||||
rel.PublisherID = author.ID
|
rel.PublisherID = author.ID
|
||||||
@@ -155,7 +170,8 @@ func pushUpdateAddTag(repo *Repository, gitRepo *git.Repository, tagName string)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rel.Sha1 = commit.ID.String()
|
rel.Sha1 = commit.ID.String()
|
||||||
rel.CreatedUnix = tagCreatedUnix
|
rel.Created = createdAt
|
||||||
|
rel.CreatedUnix = createdAt.Unix()
|
||||||
rel.NumCommits = commitsCount
|
rel.NumCommits = commitsCount
|
||||||
rel.IsDraft = false
|
rel.IsDraft = false
|
||||||
if rel.IsTag && author != nil {
|
if rel.IsTag && author != nil {
|
||||||
|
|||||||
@@ -1205,6 +1205,9 @@ type UserCommit struct {
|
|||||||
|
|
||||||
// ValidateCommitWithEmail check if author's e-mail of commit is corresponding to a user.
|
// ValidateCommitWithEmail check if author's e-mail of commit is corresponding to a user.
|
||||||
func ValidateCommitWithEmail(c *git.Commit) *User {
|
func ValidateCommitWithEmail(c *git.Commit) *User {
|
||||||
|
if c.Author == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
u, err := GetUserByEmail(c.Author.Email)
|
u, err := GetUserByEmail(c.Author.Email)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -1223,11 +1226,15 @@ func ValidateCommitsWithEmails(oldCommits *list.List) *list.List {
|
|||||||
for e != nil {
|
for e != nil {
|
||||||
c := e.Value.(*git.Commit)
|
c := e.Value.(*git.Commit)
|
||||||
|
|
||||||
if v, ok := emails[c.Author.Email]; !ok {
|
if c.Author != nil {
|
||||||
u, _ = GetUserByEmail(c.Author.Email)
|
if v, ok := emails[c.Author.Email]; !ok {
|
||||||
emails[c.Author.Email] = u
|
u, _ = GetUserByEmail(c.Author.Email)
|
||||||
|
emails[c.Author.Email] = u
|
||||||
|
} else {
|
||||||
|
u = v
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
u = v
|
u = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
newCommits.PushBack(UserCommit{
|
newCommits.PushBack(UserCommit{
|
||||||
|
|||||||
@@ -31,11 +31,11 @@ type Message struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewMessageFrom creates new mail message object with custom From header.
|
// NewMessageFrom creates new mail message object with custom From header.
|
||||||
func NewMessageFrom(to []string, from, subject, body string) *Message {
|
func NewMessageFrom(to []string, fromDisplayName, fromAddress, subject, body string) *Message {
|
||||||
log.Trace("NewMessageFrom (body):\n%s", body)
|
log.Trace("NewMessageFrom (body):\n%s", body)
|
||||||
|
|
||||||
msg := gomail.NewMessage()
|
msg := gomail.NewMessage()
|
||||||
msg.SetHeader("From", from)
|
msg.SetAddressHeader("From", fromAddress, fromDisplayName)
|
||||||
msg.SetHeader("To", to...)
|
msg.SetHeader("To", to...)
|
||||||
msg.SetHeader("Subject", subject)
|
msg.SetHeader("Subject", subject)
|
||||||
msg.SetDateHeader("Date", time.Now())
|
msg.SetDateHeader("Date", time.Now())
|
||||||
@@ -58,7 +58,7 @@ func NewMessageFrom(to []string, from, subject, body string) *Message {
|
|||||||
|
|
||||||
// NewMessage creates new mail message object with default From header.
|
// NewMessage creates new mail message object with default From header.
|
||||||
func NewMessage(to []string, subject, body string) *Message {
|
func NewMessage(to []string, subject, body string) *Message {
|
||||||
return NewMessageFrom(to, setting.MailService.From, subject, body)
|
return NewMessageFrom(to, setting.MailService.FromName, setting.MailService.FromEmail, subject, body)
|
||||||
}
|
}
|
||||||
|
|
||||||
type loginAuth struct {
|
type loginAuth struct {
|
||||||
|
|||||||
@@ -432,7 +432,7 @@ var (
|
|||||||
}{
|
}{
|
||||||
DisableDiffHighlight: false,
|
DisableDiffHighlight: false,
|
||||||
MaxGitDiffLines: 1000,
|
MaxGitDiffLines: 1000,
|
||||||
MaxGitDiffLineCharacters: 500,
|
MaxGitDiffLineCharacters: 5000,
|
||||||
MaxGitDiffFiles: 100,
|
MaxGitDiffFiles: 100,
|
||||||
GCArgs: []string{},
|
GCArgs: []string{},
|
||||||
Timeout: struct {
|
Timeout: struct {
|
||||||
@@ -1281,6 +1281,7 @@ type Mailer struct {
|
|||||||
QueueLength int
|
QueueLength int
|
||||||
Name string
|
Name string
|
||||||
From string
|
From string
|
||||||
|
FromName string
|
||||||
FromEmail string
|
FromEmail string
|
||||||
SendAsPlainText bool
|
SendAsPlainText bool
|
||||||
|
|
||||||
@@ -1339,6 +1340,7 @@ func newMailService() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(4, "Invalid mailer.FROM (%s): %v", MailService.From, err)
|
log.Fatal(4, "Invalid mailer.FROM (%s): %v", MailService.From, err)
|
||||||
}
|
}
|
||||||
|
MailService.FromName = parsed.Name
|
||||||
MailService.FromEmail = parsed.Address
|
MailService.FromEmail = parsed.Address
|
||||||
|
|
||||||
log.Info("Mail Service Enabled")
|
log.Info("Mail Service Enabled")
|
||||||
|
|||||||
@@ -1456,7 +1456,7 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
// Emojify
|
// Emojify
|
||||||
emojify.setConfig({
|
emojify.setConfig({
|
||||||
img_dir: suburl + '/plugins/emojify/images',
|
img_dir: suburl + '/vendor/plugins/emojify/images',
|
||||||
ignore_emoticons: true
|
ignore_emoticons: true
|
||||||
});
|
});
|
||||||
var hasEmoji = document.getElementsByClassName('has-emoji');
|
var hasEmoji = document.getElementsByClassName('has-emoji');
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ package user
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Unknwon/com"
|
|
||||||
|
|
||||||
api "code.gitea.io/sdk/gitea"
|
|
||||||
|
|
||||||
"code.gitea.io/gitea/models"
|
"code.gitea.io/gitea/models"
|
||||||
"code.gitea.io/gitea/modules/context"
|
"code.gitea.io/gitea/modules/context"
|
||||||
|
"code.gitea.io/gitea/modules/markdown"
|
||||||
|
api "code.gitea.io/sdk/gitea"
|
||||||
|
|
||||||
|
"github.com/Unknwon/com"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Search search users
|
// Search search users
|
||||||
@@ -50,7 +50,7 @@ func Search(ctx *context.APIContext) {
|
|||||||
ID: users[i].ID,
|
ID: users[i].ID,
|
||||||
UserName: users[i].Name,
|
UserName: users[i].Name,
|
||||||
AvatarURL: users[i].AvatarLink(),
|
AvatarURL: users[i].AvatarLink(),
|
||||||
FullName: users[i].FullName,
|
FullName: markdown.Sanitize(users[i].FullName),
|
||||||
}
|
}
|
||||||
if ctx.IsSigned {
|
if ctx.IsSigned {
|
||||||
results[i].Email = users[i].Email
|
results[i].Email = users[i].Email
|
||||||
|
|||||||
@@ -14,7 +14,8 @@
|
|||||||
<input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="direct" {{if eq .commit_choice "direct"}}checked{{end}}>
|
<input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="direct" {{if eq .commit_choice "direct"}}checked{{end}}>
|
||||||
<label>
|
<label>
|
||||||
<i class="octicon octicon-git-commit" height="16" width="14"></i>
|
<i class="octicon octicon-git-commit" height="16" width="14"></i>
|
||||||
{{.i18n.Tr "repo.editor.commit_directly_to_this_branch" .BranchName | Safe}}
|
{{$branchName := .BranchName | Str2html}}
|
||||||
|
{{.i18n.Tr "repo.editor.commit_directly_to_this_branch" $branchName | Safe}}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
{{if .Issue.PullRequest.HasMerged}}
|
{{if .Issue.PullRequest.HasMerged}}
|
||||||
{{ $mergedStr:= TimeSince .Issue.PullRequest.Merged $.Lang }}
|
{{ $mergedStr:= TimeSince .Issue.PullRequest.Merged $.Lang }}
|
||||||
<a {{if gt .Issue.PullRequest.Merger.ID 0}}href="{{.Issue.PullRequest.Merger.HomeLink}}"{{end}}>{{.Issue.PullRequest.Merger.Name}}</a>
|
<a {{if gt .Issue.PullRequest.Merger.ID 0}}href="{{.Issue.PullRequest.Merger.HomeLink}}"{{end}}>{{.Issue.PullRequest.Merger.Name}}</a>
|
||||||
<span class="pull-desc">{{$.i18n.Tr "repo.pulls.merged_title_desc" .NumCommits .HeadTarget .BaseTarget $mergedStr | Safe}}</span>
|
<span class="pull-desc">{{$.i18n.Tr "repo.pulls.merged_title_desc" .NumCommits .HeadTarget .BaseTarget $mergedStr | Str2html}}</span>
|
||||||
{{else}}
|
{{else}}
|
||||||
<a {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.Name}}</a>
|
<a {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.Name}}</a>
|
||||||
<span class="pull-desc">{{$.i18n.Tr "repo.pulls.title_desc" .NumCommits .HeadTarget .BaseTarget | Str2html}}</span>
|
<span class="pull-desc">{{$.i18n.Tr "repo.pulls.title_desc" .NumCommits .HeadTarget .BaseTarget | Str2html}}</span>
|
||||||
|
|||||||
@@ -4,14 +4,16 @@
|
|||||||
<th class="four wide">
|
<th class="four wide">
|
||||||
{{if .LatestCommitUser}}
|
{{if .LatestCommitUser}}
|
||||||
<img class="ui avatar image img-12" src="{{.LatestCommitUser.RelAvatarLink}}" />
|
<img class="ui avatar image img-12" src="{{.LatestCommitUser.RelAvatarLink}}" />
|
||||||
{{if .LatestCommitUser.FullName}}
|
{{if .LatestCommitUser.FullName}}
|
||||||
<a href="{{AppSubUrl}}/{{.LatestCommitUser.Name}}"><strong>{{.LatestCommitUser.FullName}}</strong></a>
|
<a href="{{AppSubUrl}}/{{.LatestCommitUser.Name}}"><strong>{{.LatestCommitUser.FullName}}</strong></a>
|
||||||
{{else}}
|
{{else}}
|
||||||
<a href="{{AppSubUrl}}/{{.LatestCommitUser.Name}}"><strong>{{.LatestCommit.Author.Name}}</strong></a>
|
<a href="{{AppSubUrl}}/{{.LatestCommitUser.Name}}"><strong>{{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}}</strong></a>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<img class="ui avatar image img-12" src="{{AvatarLink .LatestCommit.Author.Email}}" />
|
{{if .LatestCommit.Author}}
|
||||||
<strong>{{.LatestCommit.Author.Name}}</strong>
|
<img class="ui avatar image img-12" src="{{AvatarLink .LatestCommit.Author.Email}}" />
|
||||||
|
<strong>{{.LatestCommit.Author.Name}}</strong>
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
<a rel="nofollow" class="ui sha label {{if .LatestCommit.Signature}} isSigned {{if .LatestCommitVerification.Verified }} isVerified {{end}}{{end}}" href="{{.RepoLink}}/commit/{{.LatestCommit.ID}}">
|
<a rel="nofollow" class="ui sha label {{if .LatestCommit.Signature}} isSigned {{if .LatestCommitVerification.Verified }} isVerified {{end}}{{end}}" href="{{.RepoLink}}/commit/{{.LatestCommit.ID}}">
|
||||||
{{ShortSha .LatestCommit.ID.String}}
|
{{ShortSha .LatestCommit.ID.String}}
|
||||||
@@ -29,7 +31,7 @@
|
|||||||
</th>
|
</th>
|
||||||
<th class="nine wide">
|
<th class="nine wide">
|
||||||
</th>
|
</th>
|
||||||
<th class="three wide text grey right age">{{TimeSince .LatestCommit.Author.When $.Lang}}</th>
|
<th class="three wide text grey right age">{{if .LatestCommit.Author}}{{TimeSince .LatestCommit.Author.When $.Lang}}{{end}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|||||||
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)
|
||||||
|
|||||||
13
vendor/code.gitea.io/git/commit.go
generated
vendored
13
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
|
cmd = NewCommand("rev-list", "--count")
|
||||||
if version.Compare(gitVersion, "1.8.0", "<") {
|
|
||||||
isFallback = true
|
|
||||||
cmd = NewCommand("log", "--pretty=format:''")
|
|
||||||
} else {
|
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|||||||
36
vendor/code.gitea.io/git/repo_commit.go
generated
vendored
36
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
|
||||||
|
|||||||
25
vendor/code.gitea.io/git/signature.go
generated
vendored
25
vendor/code.gitea.io/git/signature.go
generated
vendored
@@ -32,17 +32,22 @@ 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.
|
||||||
firstChar := line[emailEnd+2]
|
if len(line) > emailEnd+2 {
|
||||||
if firstChar >= 48 && firstChar <= 57 {
|
firstChar := line[emailEnd+2]
|
||||||
timestop := bytes.IndexByte(line[emailEnd+2:], ' ')
|
if firstChar >= 48 && firstChar <= 57 {
|
||||||
timestring := string(line[emailEnd+2 : emailEnd+2+timestop])
|
timestop := bytes.IndexByte(line[emailEnd+2:], ' ')
|
||||||
seconds, _ := strconv.ParseInt(timestring, 10, 64)
|
timestring := string(line[emailEnd+2 : emailEnd+2+timestop])
|
||||||
sig.When = time.Unix(seconds, 0)
|
seconds, _ := strconv.ParseInt(timestring, 10, 64)
|
||||||
} else {
|
sig.When = time.Unix(seconds, 0)
|
||||||
sig.When, err = time.Parse("Mon Jan _2 15:04:05 2006 -0700", string(line[emailEnd+2:]))
|
} else {
|
||||||
if err != nil {
|
sig.When, err = time.Parse("Mon Jan _2 15:04:05 2006 -0700", string(line[emailEnd+2:]))
|
||||||
return nil, err
|
if err != nil {
|
||||||
|
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 New Issue
Block a user