diff options
Diffstat (limited to 'modules/repository/push.go')
-rw-r--r-- | modules/repository/push.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/repository/push.go b/modules/repository/push.go index 038735f585..728e61c839 100644 --- a/modules/repository/push.go +++ b/modules/repository/push.go @@ -5,6 +5,7 @@ package repository import ( + "context" "strings" repo_model "code.gitea.io/gitea/models/repo" @@ -98,12 +99,12 @@ func (opts *PushUpdateOptions) RepoFullName() string { } // IsForcePush detect if a push is a force push -func IsForcePush(opts *PushUpdateOptions) (bool, error) { +func IsForcePush(ctx context.Context, opts *PushUpdateOptions) (bool, error) { if !opts.IsUpdateBranch() { return false, nil } - output, err := git.NewCommand("rev-list", "--max-count=1", opts.OldCommitID, "^"+opts.NewCommitID). + output, err := git.NewCommandContext(ctx, "rev-list", "--max-count=1", opts.OldCommitID, "^"+opts.NewCommitID). RunInDir(repo_model.RepoPath(opts.RepoUserName, opts.RepoName)) if err != nil { return false, err |