07076f838d0274068db268e9eaf86c19c5fef223

Author
Noel <ncower@nil.dev>
Committer
Ayman Bagabas <ayman.bagabas@gmail.com>
Date

Message

fix(mirror): skip LFS instead of failing to mirror a repo

If an LFS client can't be created because it's not compatible for
some reason, skip it entirely for a mirrored repo. This prevents one
possible crash when mirroring fails. It still seems to crash when
accessing user info, so something is still missing. Either way, it
seems valid to skip LFS if it just won't work.

Diff

 1diff --git a/pkg/backend/repo.go b/pkg/backend/repo.go
 2index 231d94e6f787b779536bf2db0f53817dc53c4f8b..ddc27daddd74cad83241b6176a9fa6e7ab509836 100644
 3--- a/pkg/backend/repo.go
 4+++ b/pkg/backend/repo.go
 5@@ -190,7 +190,8 @@ func (d *Backend) ImportRepository(_ context.Context, name string, user proto.Us
 6 
 7 		client := lfs.NewClient(ep)
 8 		if client == nil {
 9-			return fmt.Errorf("failed to create lfs client: unsupported endpoint %s", endpoint)
10+			d.logger.Warn("failed to create lfs client: unsupported endpoint", "endpoint", endpoint)
11+			return nil
12 		}
13 
14 		if err := StoreRepoMissingLFSObjects(ctx, r, d.db, d.store, client); err != nil {