summaryrefslogtreecommitdiffstats
path: root/services/repository/migrate.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/repository/migrate.go')
-rw-r--r--services/repository/migrate.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/services/repository/migrate.go b/services/repository/migrate.go
index 39ced04ae3..b5735ac5b2 100644
--- a/services/repository/migrate.go
+++ b/services/repository/migrate.go
@@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"net/http"
- "strings"
"time"
"code.gitea.io/gitea/models/db"
@@ -253,10 +252,10 @@ func MigrateRepositoryGitData(ctx context.Context, u *user_model.User,
func cleanUpMigrateGitConfig(ctx context.Context, repoPath string) error {
cmd := git.NewCommand(ctx, "remote", "rm", "origin")
// if the origin does not exist
- _, stderr, err := cmd.RunStdString(&git.RunOpts{
+ _, _, err := cmd.RunStdString(&git.RunOpts{
Dir: repoPath,
})
- if err != nil && !strings.HasPrefix(stderr, "fatal: No such remote") {
+ if err != nil && !git.IsRemoteNotExistError(err) {
return err
}
return nil
@@ -275,7 +274,7 @@ func CleanUpMigrateInfo(ctx context.Context, repo *repo_model.Repository) (*repo
}
_, _, err := git.NewCommand(ctx, "remote", "rm", "origin").RunStdString(&git.RunOpts{Dir: repoPath})
- if err != nil && !strings.HasPrefix(err.Error(), "exit status 128 - fatal: No such remote ") {
+ if err != nil && !git.IsRemoteNotExistError(err) {
return repo, fmt.Errorf("CleanUpMigrateInfo: %w", err)
}