mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-01 06:34:36 -04:00
Simplify parameter types (#18006)
Remove repeated type declarations in function definitions.
This commit is contained in:
parent
25677cdc5b
commit
ff2fd08228
59 changed files with 115 additions and 116 deletions
|
@ -386,7 +386,7 @@ type DivergeObject struct {
|
|||
Behind int
|
||||
}
|
||||
|
||||
func checkDivergence(repoPath string, baseBranch string, targetBranch string) (int, error) {
|
||||
func checkDivergence(repoPath, baseBranch, targetBranch string) (int, error) {
|
||||
branches := fmt.Sprintf("%s..%s", baseBranch, targetBranch)
|
||||
cmd := NewCommand("rev-list", "--count", branches)
|
||||
stdout, err := cmd.RunInDir(repoPath)
|
||||
|
@ -401,7 +401,7 @@ func checkDivergence(repoPath string, baseBranch string, targetBranch string) (i
|
|||
}
|
||||
|
||||
// GetDivergingCommits returns the number of commits a targetBranch is ahead or behind a baseBranch
|
||||
func GetDivergingCommits(repoPath string, baseBranch string, targetBranch string) (DivergeObject, error) {
|
||||
func GetDivergingCommits(repoPath, baseBranch, targetBranch string) (DivergeObject, error) {
|
||||
// $(git rev-list --count master..feature) commits ahead of master
|
||||
ahead, errorAhead := checkDivergence(repoPath, baseBranch, targetBranch)
|
||||
if errorAhead != nil {
|
||||
|
|
|
@ -264,7 +264,7 @@ func (repo *Repository) FilesCountBetween(startCommitID, endCommitID string) (in
|
|||
|
||||
// CommitsBetween returns a list that contains commits between [before, last).
|
||||
// If before is detached (removed by reset + push) it is not included.
|
||||
func (repo *Repository) CommitsBetween(last *Commit, before *Commit) ([]*Commit, error) {
|
||||
func (repo *Repository) CommitsBetween(last, before *Commit) ([]*Commit, error) {
|
||||
var stdout []byte
|
||||
var err error
|
||||
if before == nil {
|
||||
|
@ -284,7 +284,7 @@ func (repo *Repository) CommitsBetween(last *Commit, before *Commit) ([]*Commit,
|
|||
}
|
||||
|
||||
// CommitsBetweenLimit returns a list that contains at most limit commits skipping the first skip commits between [before, last)
|
||||
func (repo *Repository) CommitsBetweenLimit(last *Commit, before *Commit, limit, skip int) ([]*Commit, error) {
|
||||
func (repo *Repository) CommitsBetweenLimit(last, before *Commit, limit, skip int) ([]*Commit, error) {
|
||||
var stdout []byte
|
||||
var err error
|
||||
if before == nil {
|
||||
|
|
|
@ -27,7 +27,7 @@ type CompareInfo struct {
|
|||
}
|
||||
|
||||
// GetMergeBase checks and returns merge base of two branches and the reference used as base.
|
||||
func (repo *Repository) GetMergeBase(tmpRemote string, base, head string) (string, string, error) {
|
||||
func (repo *Repository) GetMergeBase(tmpRemote, base, head string) (string, string, error) {
|
||||
if tmpRemote == "" {
|
||||
tmpRemote = "origin"
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ type CommitTreeOpts struct {
|
|||
}
|
||||
|
||||
// CommitTree creates a commit from a given tree id for the user with provided message
|
||||
func (repo *Repository) CommitTree(author *Signature, committer *Signature, tree *Tree, opts CommitTreeOpts) (SHA1, error) {
|
||||
func (repo *Repository) CommitTree(author, committer *Signature, tree *Tree, opts CommitTreeOpts) (SHA1, error) {
|
||||
err := LoadGitVersion()
|
||||
if err != nil {
|
||||
return SHA1{}, err
|
||||
|
|
|
@ -125,7 +125,7 @@ func SplitRefName(refStr string) (string, string) {
|
|||
// 0 is false, true
|
||||
// Any other integer is true, true
|
||||
// Anything else will return false, false
|
||||
func ParseBool(value string) (result bool, valid bool) {
|
||||
func ParseBool(value string) (result, valid bool) {
|
||||
// Empty strings are true but invalid
|
||||
if len(value) == 0 {
|
||||
return true, false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue