Backport #17598 Backport #17606 Backport #17608 Backport #17609 - Since https://gitea.com/gitea/test-env/pulls/10 the golangci-lint has been upgraded and is erroring about new warnings in the code, this PR fixes those warnings.
This commit is contained in:
parent
1cec7f5ab5
commit
ea0fe83888
96 changed files with 139 additions and 64 deletions
|
@ -9,7 +9,6 @@ linters:
|
||||||
- unused
|
- unused
|
||||||
- structcheck
|
- structcheck
|
||||||
- varcheck
|
- varcheck
|
||||||
- golint
|
|
||||||
- dupl
|
- dupl
|
||||||
#- gocyclo # The cyclomatic complexety of a lot of functions is too high, we should refactor those another time.
|
#- gocyclo # The cyclomatic complexety of a lot of functions is too high, we should refactor those another time.
|
||||||
- gofmt
|
- gofmt
|
||||||
|
|
3
build.go
3
build.go
|
@ -2,7 +2,8 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//+build vendor
|
//go:build vendor
|
||||||
|
// +build vendor
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
// gocovmerge takes the results from multiple `go test -coverprofile` runs and
|
// gocovmerge takes the results from multiple `go test -coverprofile` runs and
|
||||||
// merges them into one profile
|
// merges them into one profile
|
||||||
|
|
||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
|
@ -43,7 +43,11 @@ func runDocs(ctx *cli.Context) error {
|
||||||
// Clean up markdown. The following bug was fixed in v2, but is present in v1.
|
// Clean up markdown. The following bug was fixed in v2, but is present in v1.
|
||||||
// It affects markdown output (even though the issue is referring to man pages)
|
// It affects markdown output (even though the issue is referring to man pages)
|
||||||
// https://github.com/urfave/cli/issues/1040
|
// https://github.com/urfave/cli/issues/1040
|
||||||
docs = docs[strings.Index(docs, "#"):]
|
firstHashtagIndex := strings.Index(docs, "#")
|
||||||
|
|
||||||
|
if firstHashtagIndex > 0 {
|
||||||
|
docs = docs[firstHashtagIndex:]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out := os.Stdout
|
out := os.Stdout
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build bindata
|
||||||
// +build bindata
|
// +build bindata
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !bindata
|
||||||
// +build !bindata
|
// +build !bindata
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
|
@ -7,6 +7,7 @@ package migrations
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
@ -762,8 +763,14 @@ func dropTableColumns(sess *xorm.Session, tableName string, columnNames ...strin
|
||||||
}
|
}
|
||||||
tableSQL := string(res[0]["sql"])
|
tableSQL := string(res[0]["sql"])
|
||||||
|
|
||||||
|
// Get the string offset for column definitions: `CREATE TABLE ( column-definitions... )`
|
||||||
|
columnDefinitionsIndex := strings.Index(tableSQL, "(")
|
||||||
|
if columnDefinitionsIndex < 0 {
|
||||||
|
return errors.New("couldn't find column definitions")
|
||||||
|
}
|
||||||
|
|
||||||
// Separate out the column definitions
|
// Separate out the column definitions
|
||||||
tableSQL = tableSQL[strings.Index(tableSQL, "("):]
|
tableSQL = tableSQL[columnDefinitionsIndex:]
|
||||||
|
|
||||||
// Remove the required columnNames
|
// Remove the required columnNames
|
||||||
for _, name := range columnNames {
|
for _, name := range columnNames {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build pam
|
||||||
// +build pam
|
// +build pam
|
||||||
|
|
||||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// +build !pam
|
|
||||||
|
|
||||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !pam
|
||||||
|
// +build !pam
|
||||||
|
|
||||||
package pam
|
package pam
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build pam
|
||||||
// +build pam
|
// +build pam
|
||||||
|
|
||||||
// Copyright 2021 The Gitea Authors. All rights reserved.
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build race
|
||||||
// +build race
|
// +build race
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package pipeline
|
package pipeline
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package pipeline
|
package pipeline
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -52,9 +52,7 @@ func getRefURL(refURL, urlPrefix, repoFullName, sshDomain string) string {
|
||||||
urlPrefixHostname = prefixURL.Host
|
urlPrefixHostname = prefixURL.Host
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasSuffix(urlPrefix, "/") {
|
urlPrefix = strings.TrimSuffix(urlPrefix, "/")
|
||||||
urlPrefix = urlPrefix[:len(urlPrefix)-1]
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: Need to consider branch - which will require changes in modules/git/commit.go:GetSubModules
|
// FIXME: Need to consider branch - which will require changes in modules/git/commit.go:GetSubModules
|
||||||
// Relative url prefix check (according to git submodule documentation)
|
// Relative url prefix check (according to git submodule documentation)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -217,11 +217,9 @@ func newRefsFromRefNames(refNames []byte) []git.Reference {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
refName := string(refNameBytes)
|
refName := string(refNameBytes)
|
||||||
if strings.HasPrefix(refName, "tag: ") {
|
refName = strings.TrimPrefix(refName, "tag: ")
|
||||||
refName = strings.TrimPrefix(refName, "tag: ")
|
refName = strings.TrimPrefix(refName, "HEAD -> ")
|
||||||
} else if strings.HasPrefix(refName, "HEAD -> ") {
|
|
||||||
refName = strings.TrimPrefix(refName, "HEAD -> ")
|
|
||||||
}
|
|
||||||
refs = append(refs, git.Reference{
|
refs = append(refs, git.Reference{
|
||||||
Name: refName,
|
Name: refName,
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !windows
|
||||||
|
// +build !windows
|
||||||
|
|
||||||
package graceful
|
package graceful
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
// +build windows
|
|
||||||
|
|
||||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
||||||
|
|
||||||
|
//go:build windows
|
||||||
|
// +build windows
|
||||||
|
|
||||||
package graceful
|
package graceful
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
||||||
|
|
||||||
|
//go:build !windows
|
||||||
|
// +build !windows
|
||||||
|
|
||||||
package graceful
|
package graceful
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
// +build windows
|
|
||||||
|
|
||||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
||||||
|
|
||||||
|
//go:build windows
|
||||||
|
// +build windows
|
||||||
|
|
||||||
package graceful
|
package graceful
|
||||||
|
|
||||||
import "net"
|
import "net"
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
||||||
|
|
||||||
|
//go:build !windows
|
||||||
|
// +build !windows
|
||||||
|
|
||||||
package graceful
|
package graceful
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -174,6 +174,10 @@ func NewBleveIndexer(indexDir string) (*BleveIndexer, bool, error) {
|
||||||
indexDir: indexDir,
|
indexDir: indexDir,
|
||||||
}
|
}
|
||||||
created, err := indexer.init()
|
created, err := indexer.init()
|
||||||
|
if err != nil {
|
||||||
|
indexer.Close()
|
||||||
|
return nil, false, err
|
||||||
|
}
|
||||||
return indexer, created, err
|
return indexer, created, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,10 @@ func NewElasticSearchIndexer(url, indexerName string) (*ElasticSearchIndexer, bo
|
||||||
indexerAliasName: indexerName,
|
indexerAliasName: indexerName,
|
||||||
}
|
}
|
||||||
exists, err := indexer.init()
|
exists, err := indexer.init()
|
||||||
|
if err != nil {
|
||||||
|
indexer.Close()
|
||||||
|
return nil, false, err
|
||||||
|
}
|
||||||
return indexer, !exists, err
|
return indexer, !exists, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,9 +188,6 @@ func Init() {
|
||||||
|
|
||||||
rIndexer, populate, err = NewBleveIndexer(setting.Indexer.RepoPath)
|
rIndexer, populate, err = NewBleveIndexer(setting.Indexer.RepoPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if rIndexer != nil {
|
|
||||||
rIndexer.Close()
|
|
||||||
}
|
|
||||||
cancel()
|
cancel()
|
||||||
indexer.Close()
|
indexer.Close()
|
||||||
close(waitChannel)
|
close(waitChannel)
|
||||||
|
@ -208,9 +205,6 @@ func Init() {
|
||||||
|
|
||||||
rIndexer, populate, err = NewElasticSearchIndexer(setting.Indexer.RepoConnStr, setting.Indexer.RepoIndexerName)
|
rIndexer, populate, err = NewElasticSearchIndexer(setting.Indexer.RepoConnStr, setting.Indexer.RepoIndexerName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if rIndexer != nil {
|
|
||||||
rIndexer.Close()
|
|
||||||
}
|
|
||||||
cancel()
|
cancel()
|
||||||
indexer.Close()
|
indexer.Close()
|
||||||
close(waitChannel)
|
close(waitChannel)
|
||||||
|
|
|
@ -27,7 +27,7 @@ func handle(data ...queue.Data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func initStatsQueue() error {
|
func initStatsQueue() error {
|
||||||
statsQueue = queue.CreateUniqueQueue("repo_stats_update", handle, int64(0)).(queue.UniqueQueue)
|
statsQueue = queue.CreateUniqueQueue("repo_stats_update", handle, int64(0))
|
||||||
if statsQueue == nil {
|
if statsQueue == nil {
|
||||||
return fmt.Errorf("Unable to create repo_stats_update Queue")
|
return fmt.Errorf("Unable to create repo_stats_update Queue")
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,9 +29,7 @@ func endpointFromCloneURL(rawurl string) *url.URL {
|
||||||
return ep
|
return ep
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasSuffix(ep.Path, "/") {
|
ep.Path = strings.TrimSuffix(ep.Path, "/")
|
||||||
ep.Path = ep.Path[:len(ep.Path)-1]
|
|
||||||
}
|
|
||||||
|
|
||||||
if ep.Scheme == "file" {
|
if ep.Scheme == "file" {
|
||||||
return ep
|
return ep
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package lfs
|
package lfs
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package lfs
|
package lfs
|
||||||
|
|
|
@ -126,7 +126,7 @@ type Footnote struct {
|
||||||
func (n *Footnote) Dump(source []byte, level int) {
|
func (n *Footnote) Dump(source []byte, level int) {
|
||||||
m := map[string]string{}
|
m := map[string]string{}
|
||||||
m["Index"] = fmt.Sprintf("%v", n.Index)
|
m["Index"] = fmt.Sprintf("%v", n.Index)
|
||||||
m["Ref"] = fmt.Sprintf("%s", n.Ref)
|
m["Ref"] = string(n.Ref)
|
||||||
m["Name"] = fmt.Sprintf("%v", n.Name)
|
m["Name"] = fmt.Sprintf("%v", n.Name)
|
||||||
ast.DumpHelper(n, source, level, m, nil)
|
ast.DumpHelper(n, source, level, m, nil)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// +build !bindata
|
|
||||||
|
|
||||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !bindata
|
||||||
|
// +build !bindata
|
||||||
|
|
||||||
package options
|
package options
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//+build bindata
|
//go:build bindata
|
||||||
|
// +build bindata
|
||||||
|
|
||||||
package options
|
package options
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build bindata
|
||||||
// +build bindata
|
// +build bindata
|
||||||
|
|
||||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// +build !bindata
|
|
||||||
|
|
||||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !bindata
|
||||||
|
// +build !bindata
|
||||||
|
|
||||||
package public
|
package public
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//+build bindata
|
//go:build bindata
|
||||||
|
// +build bindata
|
||||||
|
|
||||||
package public
|
package public
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build bindata
|
||||||
// +build bindata
|
// +build bindata
|
||||||
|
|
||||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||||
|
|
|
@ -152,7 +152,7 @@ func ListUnadoptedRepositories(query string, opts *models.ListOptions) ([]string
|
||||||
count := 0
|
count := 0
|
||||||
|
|
||||||
// We're going to iterate by pagesize.
|
// We're going to iterate by pagesize.
|
||||||
root := filepath.Join(setting.RepoRootPath)
|
root := filepath.Clean(setting.RepoRootPath)
|
||||||
if err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
|
if err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build sqlite
|
||||||
// +build sqlite
|
// +build sqlite
|
||||||
|
|
||||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build bindata
|
||||||
// +build bindata
|
// +build bindata
|
||||||
|
|
||||||
package svg
|
package svg
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !bindata
|
||||||
// +build !bindata
|
// +build !bindata
|
||||||
|
|
||||||
package svg
|
package svg
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// +build !bindata
|
|
||||||
|
|
||||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !bindata
|
||||||
|
// +build !bindata
|
||||||
|
|
||||||
package templates
|
package templates
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build bindata
|
||||||
// +build bindata
|
// +build bindata
|
||||||
|
|
||||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//+build bindata
|
//go:build bindata
|
||||||
|
// +build bindata
|
||||||
|
|
||||||
package templates
|
package templates
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !windows
|
||||||
|
// +build !windows
|
||||||
|
|
||||||
package private
|
package private
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// +build windows
|
|
||||||
|
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build windows
|
||||||
|
// +build windows
|
||||||
|
|
||||||
package private
|
package private
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -130,14 +130,6 @@ func Recovery() func(next http.Handler) http.Handler {
|
||||||
log.Error("%v", combinedErr)
|
log.Error("%v", combinedErr)
|
||||||
|
|
||||||
sessionStore := session.GetSession(req)
|
sessionStore := session.GetSession(req)
|
||||||
if sessionStore == nil {
|
|
||||||
if setting.IsProd() {
|
|
||||||
http.Error(w, http.StatusText(500), 500)
|
|
||||||
} else {
|
|
||||||
http.Error(w, combinedErr, 500)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var lc = middleware.Locale(w, req)
|
var lc = middleware.Locale(w, req)
|
||||||
var store = dataStore{
|
var store = dataStore{
|
||||||
|
|
|
@ -27,7 +27,7 @@ func AdoptOrDeleteRepository(ctx *context.Context) {
|
||||||
action := ctx.Query("action")
|
action := ctx.Query("action")
|
||||||
|
|
||||||
ctxUser := ctx.User
|
ctxUser := ctx.User
|
||||||
root := filepath.Join(models.UserPath(ctxUser.LowerName))
|
root := models.UserPath(ctxUser.LowerName)
|
||||||
|
|
||||||
// check not a repo
|
// check not a repo
|
||||||
has, err := models.IsRepositoryExist(ctxUser, dir)
|
has, err := models.IsRepositoryExist(ctxUser, dir)
|
||||||
|
|
|
@ -246,7 +246,7 @@ func Repos(ctx *context.Context) {
|
||||||
repoNames := make([]string, 0, setting.UI.Admin.UserPagingNum)
|
repoNames := make([]string, 0, setting.UI.Admin.UserPagingNum)
|
||||||
repos := map[string]*models.Repository{}
|
repos := map[string]*models.Repository{}
|
||||||
// We're going to iterate by pagesize.
|
// We're going to iterate by pagesize.
|
||||||
root := filepath.Join(models.UserPath(ctxUser.Name))
|
root := models.UserPath(ctxUser.Name)
|
||||||
if err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
|
if err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !windows
|
||||||
// +build !windows
|
// +build !windows
|
||||||
|
|
||||||
package auth
|
package auth
|
||||||
|
|
|
@ -254,7 +254,7 @@ func CheckPrsForBaseBranch(baseRepo *models.Repository, baseBranchName string) e
|
||||||
|
|
||||||
// Init runs the task queue to test all the checking status pull requests
|
// Init runs the task queue to test all the checking status pull requests
|
||||||
func Init() error {
|
func Init() error {
|
||||||
prQueue = queue.CreateUniqueQueue("pr_patch_checker", handle, "").(queue.UniqueQueue)
|
prQueue = queue.CreateUniqueQueue("pr_patch_checker", handle, "")
|
||||||
|
|
||||||
if prQueue == nil {
|
if prQueue == nil {
|
||||||
return fmt.Errorf("Unable to create pr_patch_checker Queue")
|
return fmt.Errorf("Unable to create pr_patch_checker Queue")
|
||||||
|
|
|
@ -273,8 +273,8 @@ func rawMerge(pr *models.PullRequest, doer *models.User, mergeStyle models.Merge
|
||||||
filepath.Join(tmpBasePath, ".git", "rebase-merge", "stopped-sha"), // Git >= 2.26
|
filepath.Join(tmpBasePath, ".git", "rebase-merge", "stopped-sha"), // Git >= 2.26
|
||||||
}
|
}
|
||||||
for _, failingCommitPath := range failingCommitPaths {
|
for _, failingCommitPath := range failingCommitPaths {
|
||||||
if _, statErr := os.Stat(filepath.Join(failingCommitPath)); statErr == nil {
|
if _, statErr := os.Stat(failingCommitPath); statErr == nil {
|
||||||
commitShaBytes, readErr := ioutil.ReadFile(filepath.Join(failingCommitPath))
|
commitShaBytes, readErr := ioutil.ReadFile(failingCommitPath)
|
||||||
if readErr != nil {
|
if readErr != nil {
|
||||||
// Abandon this attempt to handle the error
|
// Abandon this attempt to handle the error
|
||||||
log.Error("git rebase staging on to base [%s:%s -> %s:%s]: %v\n%s\n%s", pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseRepo.FullName(), pr.BaseBranch, err, outbuf.String(), errbuf.String())
|
log.Error("git rebase staging on to base [%s:%s -> %s:%s]: %v\n%s\n%s", pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseRepo.FullName(), pr.BaseBranch, err, outbuf.String(), errbuf.String())
|
||||||
|
|
|
@ -36,7 +36,7 @@ func handle(data ...queue.Data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func initPushQueue() error {
|
func initPushQueue() error {
|
||||||
pushQueue = queue.CreateQueue("push_update", handle, []*repo_module.PushUpdateOptions{}).(queue.Queue)
|
pushQueue = queue.CreateQueue("push_update", handle, []*repo_module.PushUpdateOptions{})
|
||||||
if pushQueue == nil {
|
if pushQueue == nil {
|
||||||
return fmt.Errorf("Unable to create push_update Queue")
|
return fmt.Errorf("Unable to create push_update Queue")
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gofuzz
|
||||||
// +build gofuzz
|
// +build gofuzz
|
||||||
|
|
||||||
package fuzz
|
package fuzz
|
||||||
|
|
Reference in a new issue