Skip to content

Commit 1b6c249

Browse files
committed
Allow agit -o force-push work like -o force-push=true
1 parent cb739f5 commit 1b6c249

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

services/agit/agit.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ import (
2525
func ProcReceive(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository, opts *private.HookOptions) ([]private.HookProcReceiveRefResult, error) {
2626
results := make([]private.HookProcReceiveRefResult, 0, len(opts.OldCommitIDs))
2727
topicBranch := opts.GitPushOptions["topic"]
28-
forcePush, _ := strconv.ParseBool(opts.GitPushOptions["force-push"])
28+
forcePushStr := opts.GitPushOptions["force-push"]
29+
var forcePush bool
30+
if forcePushStr == "" {
31+
forcePush = true
32+
} else {
33+
forcePush, _ = strconv.ParseBool(forcePushStr)
34+
}
2935
title := strings.TrimSpace(opts.GitPushOptions["title"])
3036
description := strings.TrimSpace(opts.GitPushOptions["description"]) // TODO: Add more options?
3137
objectFormat := git.ObjectFormatFromName(repo.ObjectFormatName)

0 commit comments

Comments
 (0)