Skip to content

Commit b8370d0

Browse files
committed
Remove unrelated changes
1 parent 9ef65b3 commit b8370d0

File tree

6 files changed

+14
-18
lines changed

6 files changed

+14
-18
lines changed

models/migrations/migrations_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"code.gitea.io/gitea/modules/util"
2525

2626
"github.com/stretchr/testify/assert"
27+
"github.com/unknwon/com"
2728
"xorm.io/xorm"
2829
"xorm.io/xorm/names"
2930
)
@@ -203,7 +204,7 @@ func prepareTestEnv(t *testing.T, skip int, syncModels ...interface{}) (*xorm.En
203204
deferFn := PrintCurrentTest(t, ourSkip)
204205
assert.NoError(t, os.RemoveAll(setting.RepoRootPath))
205206

206-
assert.NoError(t, util.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"),
207+
assert.NoError(t, com.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"),
207208
setting.RepoRootPath))
208209
ownerDirs, err := os.ReadDir(setting.RepoRootPath)
209210
if err != nil {

modules/cache/cache_redis.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010

1111
"code.gitea.io/gitea/modules/graceful"
1212
"code.gitea.io/gitea/modules/nosql"
13-
"code.gitea.io/gitea/modules/util"
1413

1514
"gitea.com/go-chi/cache"
1615
"github.com/go-redis/redis/v8"
16+
"github.com/unknwon/com"
1717
)
1818

1919
// RedisCacher represents a redis cache adapter implementation.
@@ -29,15 +29,15 @@ type RedisCacher struct {
2929
func (c *RedisCacher) Put(key string, val interface{}, expire int64) error {
3030
key = c.prefix + key
3131
if expire == 0 {
32-
if err := c.c.Set(graceful.GetManager().HammerContext(), key, util.ToStr(val), 0).Err(); err != nil {
32+
if err := c.c.Set(graceful.GetManager().HammerContext(), key, com.ToStr(val), 0).Err(); err != nil {
3333
return err
3434
}
3535
} else {
36-
dur, err := time.ParseDuration(util.ToStr(expire) + "s")
36+
dur, err := time.ParseDuration(com.ToStr(expire) + "s")
3737
if err != nil {
3838
return err
3939
}
40-
if err = c.c.Set(graceful.GetManager().HammerContext(), key, util.ToStr(val), dur).Err(); err != nil {
40+
if err = c.c.Set(graceful.GetManager().HammerContext(), key, com.ToStr(val), dur).Err(); err != nil {
4141
return err
4242
}
4343
}

modules/context/csrf.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"time"
2424

2525
"code.gitea.io/gitea/modules/setting"
26-
"code.gitea.io/gitea/modules/util"
2726
"code.gitea.io/gitea/modules/web/middleware"
2827

2928
"github.com/unknwon/com"
@@ -212,7 +211,7 @@ func Csrfer(opt CsrfOptions, ctx *Context) CSRF {
212211
x.ID = "0"
213212
uid := ctx.Session.Get(opt.SessionKey)
214213
if uid != nil {
215-
x.ID = util.ToStr(uid)
214+
x.ID = com.ToStr(uid)
216215
}
217216

218217
needsNew := false

modules/sync/unique_queue.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
package sync
77

8-
import "code.gitea.io/gitea/modules/util"
8+
import (
9+
"github.com/unknwon/com"
10+
)
911

1012
// UniqueQueue is a queue which guarantees only one instance of same
1113
// identity is in the line. Instances with same identity will be
@@ -71,13 +73,13 @@ func (q *UniqueQueue) Queue() <-chan string {
7173
// Exist returns true if there is an instance with given identity
7274
// exists in the queue.
7375
func (q *UniqueQueue) Exist(id interface{}) bool {
74-
return q.table.IsRunning(util.ToStr(id))
76+
return q.table.IsRunning(com.ToStr(id))
7577
}
7678

7779
// AddFunc adds new instance to the queue with a custom runnable function,
7880
// the queue is blocked until the function exits.
7981
func (q *UniqueQueue) AddFunc(id interface{}, fn func()) {
80-
idStr := util.ToStr(id)
82+
idStr := com.ToStr(id)
8183
q.table.lock.Lock()
8284
if _, ok := q.table.pool[idStr]; ok {
8385
q.table.lock.Unlock()
@@ -103,5 +105,5 @@ func (q *UniqueQueue) Add(id interface{}) {
103105

104106
// Remove removes instance from the queue.
105107
func (q *UniqueQueue) Remove(id interface{}) {
106-
q.table.Stop(util.ToStr(id))
108+
q.table.Stop(com.ToStr(id))
107109
}

modules/util/util.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import (
1111
"math/big"
1212
"strconv"
1313
"strings"
14-
15-
"github.com/unknwon/com"
1614
)
1715

1816
// OptionalBool a boolean that can be "null"
@@ -183,8 +181,3 @@ func ToUpperASCII(s string) string {
183181
}
184182
return string(b)
185183
}
186-
187-
// ToStr should be replaced
188-
func ToStr(value interface{}, args ...int) string {
189-
return com.ToStr(value, args...)
190-
}

routers/web/repo/issue.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,7 @@ func ViewIssue(ctx *context.Context) {
11141114
metas["index"] = ctx.Params(":index")
11151115
res, err := vars.Expand(extIssueUnit.ExternalTrackerConfig().ExternalTrackerFormat, metas)
11161116
if err != nil {
1117+
log.Error("unable to expand template vars for issue url. issue: %s, err: %s", metas["index"], err.Error())
11171118
ctx.ServerError("Expand", err)
11181119
return
11191120
}

0 commit comments

Comments
 (0)