From 1b0df114345125cdb0a11b1c681a9bd2dd569066 Mon Sep 17 00:00:00 2001 From: chenyifan01 Date: Thu, 3 Mar 2022 11:20:04 +0800 Subject: [PATCH] #1250 inherit parent repo's topics when fork --- modules/repository/fork.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/repository/fork.go b/modules/repository/fork.go index da9039d00..e3ebbfee2 100644 --- a/modules/repository/fork.go +++ b/modules/repository/fork.go @@ -86,5 +86,11 @@ func ForkRepository(doer, owner *models.User, oldRepo *models.Repository, name, if err := models.CopyLanguageStat(oldRepo, repo); err != nil { log.Error("Copy language stat from oldRepo failed") } + //inherit parent repo's topics + if len(oldRepo.Topics) > 0 { + if err := models.SaveTopics(repo.ID, oldRepo.Topics...); err != nil { + log.Error("SaveTopics failed when fork,e=%v", err) + } + } return repo, models.CopyLFS(ctx, repo, oldRepo) }