func()

in internal/command/uploadpack/uploadpack.go [29:78]


func (c *Command) Execute(ctx context.Context) (context.Context, error) {
	args := c.Args.SSHArgs
	if len(args) != 2 {
		return ctx, disallowedcommand.Error
	}

	repo := args[1]
	response, err := c.verifyAccess(ctx, repo)
	if err != nil {
		return ctx, err
	}

	logData := command.NewLogData(
		response.Gitaly.Repo.GlProjectPath,
		response.Username,
		response.ProjectID,
		response.RootNamespaceID,
	)
	ctxWithLogData := context.WithValue(ctx, logDataKey{}, logData)

	if response.IsCustomAction() {
		if response.Payload.Data.GeoProxyFetchDirectToPrimary {
			cmd := githttp.PullCommand{
				Config:     c.Config,
				ReadWriter: c.ReadWriter,
				Args:       c.Args,
				Response:   response,
			}

			return ctxWithLogData, cmd.Execute(ctx)
		}

		customAction := customaction.Command{
			Config:     c.Config,
			ReadWriter: c.ReadWriter,
			EOFSent:    false,
		}
		return ctxWithLogData, customAction.Execute(ctx, response)
	}

	stats, err := c.performGitalyCall(ctx, response)
	if err != nil {
		return ctxWithLogData, err
	}

	if response.NeedAudit {
		gitauditevent.Audit(ctx, c.Args.CommandType, c.Config, response, stats)
	}
	return ctxWithLogData, nil
}