]> source.dussan.org Git - gitea.git/commitdiff
Migration: only write commit-graph if wiki clone was successfull (#19563) (#19568)
author6543 <6543@obermui.de>
Sat, 30 Apr 2022 22:22:42 +0000 (00:22 +0200)
committerGitHub <noreply@github.com>
Sat, 30 Apr 2022 22:22:42 +0000 (00:22 +0200)
modules/repository/repo.go

index b79260384af1bd02743d1fd0dd28f000acb7290d..2735536e74fb7a92c1955121e78df063fac1e88c 100644 (file)
@@ -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 {