File tree Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -615,6 +615,9 @@ Gitea or set your environment appropriately.`, "")
615
615
writePktLine (os .Stdout , pktLineTypeData , []byte ("option old-oid " + rs .OldOID ))
616
616
}
617
617
writePktLine (os .Stdout , pktLineTypeData , []byte ("option new-oid " + rs .NewOID ))
618
+ if rs .IsForcePush {
619
+ writePktLine (os .Stdout , pktLineTypeData , []byte ("option forced-update" ))
620
+ }
618
621
}
619
622
writePktLine (os .Stdout , pktLineTypeFlush , nil )
620
623
Original file line number Diff line number Diff line change @@ -82,11 +82,12 @@ type HockProcReceiveResult struct {
82
82
83
83
// HockProcReceiveRefResult represents an individual result from ProcReceive
84
84
type HockProcReceiveRefResult struct {
85
- OldOID string
86
- NewOID string
87
- Ref string
88
- OrignRef string
89
- Err string
85
+ OldOID string
86
+ NewOID string
87
+ Ref string
88
+ OrignRef string
89
+ IsForcePush bool
90
+ Err string
90
91
}
91
92
92
93
// HookPreReceive check whether the provided commits are allowed
Original file line number Diff line number Diff line change @@ -788,12 +788,14 @@ func HookProcReceive(ctx *gitea_context.PrivateContext) {
788
788
notification .NotifyPullRequestPushCommits (pusher , pr , comment )
789
789
}
790
790
notification .NotifyPullRequestSynchronized (pusher , pr )
791
+ isForcePush := comment != nil && comment .IsForcePush
791
792
792
793
results = append (results , private.HockProcReceiveRefResult {
793
- OldOID : old ,
794
- NewOID : opts .NewCommitIDs [i ],
795
- Ref : pr .GetGitRefName (),
796
- OrignRef : opts .RefFullNames [i ],
794
+ OldOID : old ,
795
+ NewOID : opts .NewCommitIDs [i ],
796
+ Ref : pr .GetGitRefName (),
797
+ OrignRef : opts .RefFullNames [i ],
798
+ IsForcePush : isForcePush ,
797
799
})
798
800
}
799
801
You can’t perform that action at this time.
0 commit comments