Skip to content

Commit d4501ec

Browse files
authored
fix bug pull request files will be broken if head repo was transfered to another user or orgnization (#8571)
1 parent c1152b1 commit d4501ec

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

models/repo.go

+7
Original file line numberDiff line numberDiff line change
@@ -1486,6 +1486,13 @@ func TransferOwnership(doer *User, newOwnerName string, repo *Repository) error
14861486
return fmt.Errorf("update owner: %v", err)
14871487
}
14881488

1489+
// Update pull request headusername
1490+
if _, err := sess.Where("head_repo_id = ?", repo.ID).Update(&PullRequest{
1491+
HeadUserName: newOwner.LowerName,
1492+
}); err != nil {
1493+
return fmt.Errorf("update pull request: %v", err)
1494+
}
1495+
14891496
// Remove redundant collaborators.
14901497
collaborators, err := repo.getCollaborators(sess)
14911498
if err != nil {

0 commit comments

Comments
 (0)