43f087f10d8c08cb1e917b73564295052b9e0789

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

Message

fix(mirror): add user missing from context

DeleteRepository, called when mirroring fails, requires access to the
user. The user isn't included in the context for the task, so attach
the closed over user to the task context.

Diff

 1diff --git a/pkg/backend/repo.go b/pkg/backend/repo.go
 2index ddc27daddd74cad83241b6176a9fa6e7ab509836..bff5658e44718688e9cbdc25fd1314dfdcd01b58 100644
 3--- a/pkg/backend/repo.go
 4+++ b/pkg/backend/repo.go
 5@@ -116,6 +116,8 @@ func (d *Backend) ImportRepository(_ context.Context, name string, user proto.Us
 6 	repoc := make(chan proto.Repository, 1)
 7 	d.logger.Info("importing repository", "name", name, "remote", remote, "path", rp)
 8 	d.manager.Add(tid, func(ctx context.Context) (err error) {
 9+		ctx = proto.WithUserContext(ctx, user)
10+
11 		copts := git.CloneOptions{
12 			Bare:   true,
13 			Mirror: opts.Mirror,