feat(vcs): add CommitID to ReviewRequest (#115) #118
+1
-1
@@ -103,7 +103,7 @@ func (c *Client) PostReview(ctx context.Context, owner, repo string, number int,
|
||||
// the resolved commit_id.
|
||||
for _, comment := range req.Comments {
|
||||
if comment.CommitID != "" {
|
||||
|
|
||||
if payload.CommitID == "" {
|
||||
if payload.CommitID == "" { // only reachable when req.CommitID is empty
|
||||
payload.CommitID = comment.CommitID
|
||||
} else if payload.CommitID != comment.CommitID {
|
||||
return nil, ErrConflictingCommitIDs
|
||||
|
||||
Reference in New Issue
Block a user
[NIT] The conflict detection logic between
req.CommitIDand per-comment CommitIDs works correctly but uses a subtle implicit assumption: the initialpayload.CommitID = req.CommitIDmeans the loop'spayload.CommitID == ""check is only true whenreq.CommitIDwas also empty. This is correct but slightly hard to follow at a glance — a brief inline comment like// req.CommitID already applied aboveon the empty-check branch would improve readability.