aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/fixtures/lfs_meta_object.yml18
-rw-r--r--models/migrations/v1_21/v276.go5
2 files changed, 21 insertions, 2 deletions
diff --git a/models/fixtures/lfs_meta_object.yml b/models/fixtures/lfs_meta_object.yml
index 1c29e02d44..5430506d70 100644
--- a/models/fixtures/lfs_meta_object.yml
+++ b/models/fixtures/lfs_meta_object.yml
@@ -1,4 +1,11 @@
# These are the LFS objects in user2/lfs.git
+# user2/lfs is an INVALID repository
+#
+# commit e9c32647bab825977942598c0efa415de300304b (HEAD -> master)
+# Author: Rowan Bohde <rowan.bohde@gmail.com>
+# Date: Thu Aug 1 14:38:23 2024 -0500
+#
+# add invalid lfs file
-
id: 1
@@ -11,7 +18,7 @@
id: 2
oid: 2eccdb43825d2a49d99d542daa20075cff1d97d9d2349a8977efe9c03661737c
- size: 107
+ size: 107 # real size is 2048
repository_id: 54
created_unix: 1671607299
@@ -30,3 +37,12 @@
size: 25
repository_id: 54
created_unix: 1671607299
+
+# this file is missing
+# -
+#
+# id: 5
+# oid: 9d178b5f15046343fd32f451df93acc2bdd9e6373be478b968e4cad6b6647351
+# size: 25
+# repository_id: 54
+# created_unix: 1671607299
diff --git a/models/migrations/v1_21/v276.go b/models/migrations/v1_21/v276.go
index ed1bc3bda5..15177bf040 100644
--- a/models/migrations/v1_21/v276.go
+++ b/models/migrations/v1_21/v276.go
@@ -12,6 +12,7 @@ import (
"code.gitea.io/gitea/modules/git"
giturl "code.gitea.io/gitea/modules/git/url"
"code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/modules/util"
"xorm.io/xorm"
)
@@ -163,7 +164,9 @@ func migratePushMirrors(x *xorm.Engine) error {
func getRemoteAddress(ownerName, repoName, remoteName string) (string, error) {
repoPath := filepath.Join(setting.RepoRootPath, strings.ToLower(ownerName), strings.ToLower(repoName)+".git")
-
+ if exist, _ := util.IsExist(repoPath); !exist {
+ return "", nil
+ }
remoteURL, err := git.GetRemoteAddress(context.Background(), repoPath, remoteName)
if err != nil {
return "", fmt.Errorf("get remote %s's address of %s/%s failed: %v", remoteName, ownerName, repoName, err)