From 755d8e21ad21af6587431f99c2e46b82b05811ca Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 1 May 2022 00:22:42 +0200 Subject: [PATCH] Migration: only write commit-graph if wiki clone was successfull (#19563) (#19568) --- modules/repository/repo.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/repository/repo.go b/modules/repository/repo.go index b79260384af..2735536e74f 100644 --- a/modules/repository/repo.go +++ b/modules/repository/repo.go @@ -92,7 +92,7 @@ func MigrateRepositoryGitData(ctx context.Context, u *user_model.User, return repo, fmt.Errorf("Failed to remove %s: %v", wikiPath, err) } - if err = git.CloneWithContext(ctx, wikiRemotePath, wikiPath, git.CloneRepoOptions{ + if err := git.CloneWithContext(ctx, wikiRemotePath, wikiPath, git.CloneRepoOptions{ Mirror: true, Quiet: true, Timeout: migrateTimeout, @@ -103,11 +103,12 @@ func MigrateRepositoryGitData(ctx context.Context, u *user_model.User, if err := util.RemoveAll(wikiPath); err != nil { return repo, fmt.Errorf("Failed to remove %s: %v", wikiPath, err) } + } else { + if err := git.WriteCommitGraph(ctx, wikiPath); err != nil { + return repo, err + } } } - if err := git.WriteCommitGraph(ctx, wikiPath); err != nil { - return repo, err - } } if repo.OwnerID == u.ID {