~edwargix/git.sr.ht

fe9d0d9ab3302a615183ac241df0a98a2f4772fc — Adnan Maolood 1 year, 10 months ago cd790c9
api/graph: Ensure files are closed after creation
1 files changed, 4 insertions(+), 2 deletions(-)

M api/graph/schema.resolvers.go
M api/graph/schema.resolvers.go => api/graph/schema.resolvers.go +4 -2
@@ 178,10 178,11 @@ func (r *mutationResolver) CreateRepository(ctx context.Context, name string, vi

		export := path.Join(repoPath, "git-daemon-export-ok")
		if repo.Visibility != model.VisibilityPrivate {
			_, err := os.Create(export)
			f, err := os.Create(export)
			if err != nil {
				return err
			}
			defer f.Close()
		}

		if cloneURL != nil {


@@ 414,10 415,11 @@ func (r *mutationResolver) UpdateRepository(ctx context.Context, id int, input m
				return err
			}
		} else {
			_, err := os.Create(export)
			f, err := os.Create(export)
			if err != nil {
				return err
			}
			defer f.Close()
		}

		webhooks.DeliverRepoEvent(ctx, model.WebhookEventRepoUpdate, &repo)