aboutsummaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/action.go1
-rw-r--r--models/git_diff.go18
-rw-r--r--models/repo.go4
3 files changed, 14 insertions, 9 deletions
diff --git a/models/action.go b/models/action.go
index 98a4f5a0..de2cdd12 100644
--- a/models/action.go
+++ b/models/action.go
@@ -332,7 +332,6 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string,
}
}
- go DeliverHooks()
return nil
}
diff --git a/models/git_diff.go b/models/git_diff.go
index 4bbe3c0e..7e91626f 100644
--- a/models/git_diff.go
+++ b/models/git_diff.go
@@ -14,12 +14,14 @@ import (
"strings"
"time"
+ "golang.org/x/net/html/charset"
+ "golang.org/x/text/transform"
+
"github.com/Unknwon/com"
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/git"
"github.com/gogits/gogs/modules/log"
- "github.com/gogits/gogs/modules/mahonia"
"github.com/gogits/gogs/modules/process"
)
@@ -192,14 +194,18 @@ func ParsePatch(pid int64, maxlines int, cmd *exec.Cmd, reader io.Reader) (*Diff
}
// FIXME: use first 30 lines to detect file encoding.
- charset, err := base.DetectEncoding(buf.Bytes())
- if charset != "utf8" && err == nil {
- decoder := mahonia.NewDecoder(charset)
- if decoder != nil {
+ charsetLabel, err := base.DetectEncoding(buf.Bytes())
+ if charsetLabel != "utf8" && err == nil {
+ encoding, _ := charset.Lookup(charsetLabel)
+
+ if encoding != nil {
+ d := encoding.NewDecoder()
for _, f := range diff.Files {
for _, sec := range f.Sections {
for _, l := range sec.Lines {
- l.Content = decoder.ConvertString(l.Content)
+ if c, _, err := transform.String(d, l.Content); err == nil {
+ l.Content = c
+ }
}
}
}
diff --git a/models/repo.go b/models/repo.go
index 77c4b140..65689b6a 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -1228,7 +1228,7 @@ func GitFsck() {
isGitFscking = true
defer func() { isGitFscking = false }()
- args := append([]string{"fsck"}, setting.GitFsckArgs...)
+ args := append([]string{"fsck"}, setting.Git.Fsck.Args...)
if err := x.Where("id > 0").Iterate(new(Repository),
func(idx int, bean interface{}) error {
repo := bean.(*Repository)
@@ -1252,7 +1252,7 @@ func GitFsck() {
}
func GitGcRepos() error {
- args := append([]string{"gc"}, setting.GitGcArgs...)
+ args := append([]string{"gc"}, setting.Git.GcArgs...)
return x.Where("id > 0").Iterate(new(Repository),
func(idx int, bean interface{}) error {
repo := bean.(*Repository)