mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-14 05:52:43 +00:00
[Vendor] Switch go-version lib (#12719)
* vendor: switch from "mcuadros/go-version" to "hashicorp/go-version" * Adapt P1 * simplify * fix lint * adapt * fix lint & rm old code * no deadlock * rm RWMutex and check GoVersion only 1-time * Copyright header Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
9fdb4f887b
commit
bc11caff94
35 changed files with 1134 additions and 966 deletions
|
@ -11,8 +11,6 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/mcuadros/go-version"
|
||||
)
|
||||
|
||||
func (repo *Repository) getTree(id SHA1) (*Tree, error) {
|
||||
|
@ -65,7 +63,7 @@ type CommitTreeOpts struct {
|
|||
|
||||
// CommitTree creates a commit from a given tree id for the user with provided message
|
||||
func (repo *Repository) CommitTree(sig *Signature, tree *Tree, opts CommitTreeOpts) (SHA1, error) {
|
||||
binVersion, err := BinVersion()
|
||||
err := LoadGitVersion()
|
||||
if err != nil {
|
||||
return SHA1{}, err
|
||||
}
|
||||
|
@ -91,11 +89,11 @@ func (repo *Repository) CommitTree(sig *Signature, tree *Tree, opts CommitTreeOp
|
|||
_, _ = messageBytes.WriteString(opts.Message)
|
||||
_, _ = messageBytes.WriteString("\n")
|
||||
|
||||
if version.Compare(binVersion, "1.7.9", ">=") && (opts.KeyID != "" || opts.AlwaysSign) {
|
||||
if CheckGitVersionConstraint(">= 1.7.9") == nil && (opts.KeyID != "" || opts.AlwaysSign) {
|
||||
cmd.AddArguments(fmt.Sprintf("-S%s", opts.KeyID))
|
||||
}
|
||||
|
||||
if version.Compare(binVersion, "2.0.0", ">=") && opts.NoGPGSign {
|
||||
if CheckGitVersionConstraint(">= 2.0.0") == nil && opts.NoGPGSign {
|
||||
cmd.AddArguments("--no-gpg-sign")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue