aboutsummaryrefslogtreecommitdiff
path: root/receivepack/results.go
blob: c046409eb95f42f9743ea1e60bcfa2e36ec1141a (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package receivepack

import (
	protoreceive "codeberg.org/lindenii/furgit/protocol/v0v1/server/receivepack"
	"codeberg.org/lindenii/furgit/receivepack/service"
)

func translateResult(result *service.Result) protoreceive.ReportStatusResult {
	out := protoreceive.ReportStatusResult{
		UnpackError: result.UnpackError,
		Commands:    make([]protoreceive.CommandResult, 0, len(result.Commands)),
	}

	for _, command := range result.Commands {
		out.Commands = append(out.Commands, protoreceive.CommandResult{
			Name:         command.Name,
			Error:        command.Error,
			RefName:      command.RefName,
			OldID:        command.OldID,
			NewID:        command.NewID,
			ForcedUpdate: command.ForcedUpdate,
		})
	}

	return out
}