Skip to content

Commit

Permalink
Fix spelling of HookProcReceiveResult (go-gitea#16690)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored Aug 14, 2021
1 parent bbf9f41 commit 74d75eb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
14 changes: 7 additions & 7 deletions modules/private/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ type HookPostReceiveBranchResult struct {
URL string
}

// HockProcReceiveResult represents an individual result from ProcReceive
type HockProcReceiveResult struct {
Results []HockProcReceiveRefResult
// HookProcReceiveResult represents an individual result from ProcReceive
type HookProcReceiveResult struct {
Results []HookProcReceiveRefResult
Err string
}

// HockProcReceiveRefResult represents an individual result from ProcReceive
type HockProcReceiveRefResult struct {
// HookProcReceiveRefResult represents an individual result from ProcReceive
type HookProcReceiveRefResult struct {
OldOID string
NewOID string
Ref string
Expand Down Expand Up @@ -150,7 +150,7 @@ func HookPostReceive(ctx context.Context, ownerName, repoName string, opts HookO
}

// HookProcReceive proc-receive hook
func HookProcReceive(ctx context.Context, ownerName, repoName string, opts HookOptions) (*HockProcReceiveResult, error) {
func HookProcReceive(ctx context.Context, ownerName, repoName string, opts HookOptions) (*HookProcReceiveResult, error) {
reqURL := setting.LocalURL + fmt.Sprintf("api/internal/hook/proc-receive/%s/%s",
url.PathEscape(ownerName),
url.PathEscape(repoName),
Expand All @@ -170,7 +170,7 @@ func HookProcReceive(ctx context.Context, ownerName, repoName string, opts HookO
if resp.StatusCode != http.StatusOK {
return nil, errors.New(decodeJSONError(resp).Err)
}
res := &HockProcReceiveResult{}
res := &HookProcReceiveResult{}
_ = json.NewDecoder(resp.Body).Decode(res)

return res, nil
Expand Down
2 changes: 1 addition & 1 deletion routers/private/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ func HookProcReceive(ctx *gitea_context.PrivateContext) {
return
}

ctx.JSON(http.StatusOK, private.HockProcReceiveResult{
ctx.JSON(http.StatusOK, private.HookProcReceiveResult{
Results: results,
})
}
Expand Down
18 changes: 9 additions & 9 deletions services/agit/agit.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
)

// ProcRecive handle proc receive work
func ProcRecive(ctx *context.PrivateContext, opts *private.HookOptions) []private.HockProcReceiveRefResult {
func ProcRecive(ctx *context.PrivateContext, opts *private.HookOptions) []private.HookProcReceiveRefResult {
// TODO: Add more options?
var (
topicBranch string
Expand All @@ -29,7 +29,7 @@ func ProcRecive(ctx *context.PrivateContext, opts *private.HookOptions) []privat
forcePush bool
)

results := make([]private.HockProcReceiveRefResult, 0, len(opts.OldCommitIDs))
results := make([]private.HookProcReceiveRefResult, 0, len(opts.OldCommitIDs))
repo := ctx.Repo.Repository
gitRepo := ctx.Repo.GitRepo
ownerName := ctx.Repo.Repository.OwnerName
Expand All @@ -40,7 +40,7 @@ func ProcRecive(ctx *context.PrivateContext, opts *private.HookOptions) []privat

for i := range opts.OldCommitIDs {
if opts.NewCommitIDs[i] == git.EmptySHA {
results = append(results, private.HockProcReceiveRefResult{
results = append(results, private.HookProcReceiveRefResult{
OriginalRef: opts.RefFullNames[i],
OldOID: opts.OldCommitIDs[i],
NewOID: opts.NewCommitIDs[i],
Expand All @@ -50,7 +50,7 @@ func ProcRecive(ctx *context.PrivateContext, opts *private.HookOptions) []privat
}

if !strings.HasPrefix(opts.RefFullNames[i], git.PullRequestPrefix) {
results = append(results, private.HockProcReceiveRefResult{
results = append(results, private.HookProcReceiveRefResult{
IsNotMatched: true,
OriginalRef: opts.RefFullNames[i],
})
Expand All @@ -71,7 +71,7 @@ func ProcRecive(ctx *context.PrivateContext, opts *private.HookOptions) []privat
}

if len(topicBranch) == 0 && len(curentTopicBranch) == 0 {
results = append(results, private.HockProcReceiveRefResult{
results = append(results, private.HookProcReceiveRefResult{
OriginalRef: opts.RefFullNames[i],
OldOID: opts.OldCommitIDs[i],
NewOID: opts.NewCommitIDs[i],
Expand Down Expand Up @@ -166,7 +166,7 @@ func ProcRecive(ctx *context.PrivateContext, opts *private.HookOptions) []privat

log.Trace("Pull request created: %d/%d", repo.ID, prIssue.ID)

results = append(results, private.HockProcReceiveRefResult{
results = append(results, private.HookProcReceiveRefResult{
Ref: pr.GetGitRefName(),
OriginalRef: opts.RefFullNames[i],
OldOID: git.EmptySHA,
Expand Down Expand Up @@ -194,7 +194,7 @@ func ProcRecive(ctx *context.PrivateContext, opts *private.HookOptions) []privat
}

if oldCommitID == opts.NewCommitIDs[i] {
results = append(results, private.HockProcReceiveRefResult{
results = append(results, private.HookProcReceiveRefResult{
OriginalRef: opts.RefFullNames[i],
OldOID: opts.OldCommitIDs[i],
NewOID: opts.NewCommitIDs[i],
Expand All @@ -212,7 +212,7 @@ func ProcRecive(ctx *context.PrivateContext, opts *private.HookOptions) []privat
})
return nil
} else if len(output) > 0 {
results = append(results, private.HockProcReceiveRefResult{
results = append(results, private.HookProcReceiveRefResult{
OriginalRef: oldCommitID,
OldOID: opts.OldCommitIDs[i],
NewOID: opts.NewCommitIDs[i],
Expand Down Expand Up @@ -255,7 +255,7 @@ func ProcRecive(ctx *context.PrivateContext, opts *private.HookOptions) []privat
notification.NotifyPullRequestSynchronized(pusher, pr)
isForcePush := comment != nil && comment.IsForcePush

results = append(results, private.HockProcReceiveRefResult{
results = append(results, private.HookProcReceiveRefResult{
OldOID: oldCommitID,
NewOID: opts.NewCommitIDs[i],
Ref: pr.GetGitRefName(),
Expand Down

0 comments on commit 74d75eb

Please sign in to comment.