77 "context"
88 "fmt"
99 "os"
10- "strconv"
1110 "strings"
1211
1312 issues_model "code.gitea.io/gitea/models/issues"
@@ -24,10 +23,10 @@ import (
2423// ProcReceive handle proc receive work
2524func ProcReceive (ctx context.Context , repo * repo_model.Repository , gitRepo * git.Repository , opts * private.HookOptions ) ([]private.HookProcReceiveRefResult , error ) {
2625 results := make ([]private.HookProcReceiveRefResult , 0 , len (opts .OldCommitIDs ))
26+ forcePush := opts .GitPushOptions .Bool (private .GitPushOptionForcePush )
2727 topicBranch := opts .GitPushOptions ["topic" ]
28- forcePush , _ := strconv .ParseBool (opts .GitPushOptions ["force-push" ])
2928 title := strings .TrimSpace (opts .GitPushOptions ["title" ])
30- description := strings .TrimSpace (opts .GitPushOptions ["description" ]) // TODO: Add more options?
29+ description := strings .TrimSpace (opts .GitPushOptions ["description" ])
3130 objectFormat := git .ObjectFormatFromName (repo .ObjectFormatName )
3231 userName := strings .ToLower (opts .UserName )
3332
@@ -178,7 +177,7 @@ func ProcReceive(ctx context.Context, repo *repo_model.Repository, gitRepo *git.
178177 continue
179178 }
180179
181- if ! forcePush {
180+ if ! forcePush . Value () {
182181 output , _ , err := git .NewCommand (ctx , "rev-list" , "--max-count=1" ).
183182 AddDynamicArguments (oldCommitID , "^" + opts .NewCommitIDs [i ]).
184183 RunStdString (& git.RunOpts {Dir : repo .RepoPath (), Env : os .Environ ()})
0 commit comments