@@ -307,55 +307,50 @@ func TestUpdateIssuesCommit_SelfReference(t *testing.T) {
307307 // PR #2 (issue_id=2) has merged_commit_id: 1a8823cd1a9549fde083f992f6b9b87a7ab74fb3
308308 pushCommits := []* repository.PushCommit {
309309 {
310- Sha1 : "1a8823cd1a9549fde083f992f6b9b87a7ab74fb3" , // This is the merge commit for PR #2
310+ Sha1 : "1a8823cd1a9549fde083f992f6b9b87a7ab74fb3" ,
311311 CommitterEmail : "user2@example.com" ,
312312 CommitterName : "User Two" ,
313313 AuthorEmail : "user2@example.com" ,
314314 AuthorName : "User Two" ,
315- Message : "Merge pull request 'issue2' (#2) from branch1 into master" , // References its own PR
315+ Message : "Merge pull request 'issue2' (#2) from branch1 into master" ,
316316 },
317317 }
318318
319319 repo := unittest .AssertExistsAndLoadBean (t , & repo_model.Repository {ID : 1 })
320320
321- // This comment should NOT be created (self-reference)
322321 selfRefCommentBean := & issues_model.Comment {
323322 Type : issues_model .CommentTypeCommitRef ,
324323 CommitSHA : "1a8823cd1a9549fde083f992f6b9b87a7ab74fb3" ,
325324 PosterID : user .ID ,
326- IssueID : 2 , // PR #2 references itself
325+ IssueID : 2 ,
327326 }
328327
329328 unittest .AssertNotExistsBean (t , selfRefCommentBean )
330329 assert .NoError (t , UpdateIssuesCommit (t .Context (), user , repo , pushCommits , repo .DefaultBranch ))
331- // The self-reference comment should still not exist
332330 unittest .AssertNotExistsBean (t , selfRefCommentBean )
333331 unittest .CheckConsistencyFor (t , & activities_model.Action {})
334332
335- // Test that normal (non-self-referencing) commit comments are still created
336- // Use a different commit that is NOT a merge commit for any PR
333+ // Test that normal commit references are still created
337334 pushCommits2 := []* repository.PushCommit {
338335 {
339- Sha1 : "abcdef9876543210" , // Different commit, not a merge commit
336+ Sha1 : "abcdef9876543210" ,
340337 CommitterEmail : "user2@example.com" ,
341338 CommitterName : "User Two" ,
342339 AuthorEmail : "user2@example.com" ,
343340 AuthorName : "User Two" ,
344- Message : "Fix bug, refs #1" , // References issue #1
341+ Message : "Fix bug, refs #1" ,
345342 },
346343 }
347344
348- // This comment SHOULD be created (reference to a different issue from a non-merge commit)
349345 otherRefCommentBean := & issues_model.Comment {
350346 Type : issues_model .CommentTypeCommitRef ,
351347 CommitSHA : "abcdef9876543210" ,
352348 PosterID : user .ID ,
353- IssueID : 1 , // References issue #1
349+ IssueID : 1 ,
354350 }
355351
356352 unittest .AssertNotExistsBean (t , otherRefCommentBean )
357353 assert .NoError (t , UpdateIssuesCommit (t .Context (), user , repo , pushCommits2 , repo .DefaultBranch ))
358- // The reference to issue #1 should exist
359354 unittest .AssertExistsAndLoadBean (t , otherRefCommentBean )
360355 unittest .CheckConsistencyFor (t , & activities_model.Action {})
361356}
0 commit comments