aboutsummaryrefslogtreecommitdiffstats
path: root/services/repository/fork.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/repository/fork.go')
-rw-r--r--services/repository/fork.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/services/repository/fork.go b/services/repository/fork.go
index fb93b10f1c..59aa173373 100644
--- a/services/repository/fork.go
+++ b/services/repository/fork.go
@@ -157,7 +157,15 @@ func ForkRepository(ctx context.Context, doer, owner *user_model.User, opts Fork
if err = repo_module.CreateDelegateHooks(repoPath); err != nil {
return fmt.Errorf("createDelegateHooks: %w", err)
}
- return nil
+
+ gitRepo, err := git.OpenRepository(txCtx, repo.RepoPath())
+ if err != nil {
+ return fmt.Errorf("OpenRepository: %w", err)
+ }
+ defer gitRepo.Close()
+
+ _, err = repo_module.SyncRepoBranchesWithRepo(txCtx, repo, gitRepo, doer.ID)
+ return err
})
needsRollbackInPanic = false
if err != nil {