7
7
"context"
8
8
"fmt"
9
9
"os"
10
- "strconv"
11
10
"strings"
12
11
13
12
issues_model "code.gitea.io/gitea/models/issues"
@@ -24,10 +23,10 @@ import (
24
23
// ProcReceive handle proc receive work
25
24
func ProcReceive (ctx context.Context , repo * repo_model.Repository , gitRepo * git.Repository , opts * private.HookOptions ) ([]private.HookProcReceiveRefResult , error ) {
26
25
results := make ([]private.HookProcReceiveRefResult , 0 , len (opts .OldCommitIDs ))
26
+ forcePush := opts .GitPushOptions .Bool (private .GitPushOptionForcePush )
27
27
topicBranch := opts .GitPushOptions ["topic" ]
28
- forcePush , _ := strconv .ParseBool (opts .GitPushOptions ["force-push" ])
29
28
title := strings .TrimSpace (opts .GitPushOptions ["title" ])
30
- description := strings .TrimSpace (opts .GitPushOptions ["description" ]) // TODO: Add more options?
29
+ description := strings .TrimSpace (opts .GitPushOptions ["description" ])
31
30
objectFormat := git .ObjectFormatFromName (repo .ObjectFormatName )
32
31
userName := strings .ToLower (opts .UserName )
33
32
@@ -178,7 +177,7 @@ func ProcReceive(ctx context.Context, repo *repo_model.Repository, gitRepo *git.
178
177
continue
179
178
}
180
179
181
- if ! forcePush {
180
+ if ! forcePush . Value () {
182
181
output , _ , err := git .NewCommand (ctx , "rev-list" , "--max-count=1" ).
183
182
AddDynamicArguments (oldCommitID , "^" + opts .NewCommitIDs [i ]).
184
183
RunStdString (& git.RunOpts {Dir : repo .RepoPath (), Env : os .Environ ()})
0 commit comments