From 3d25bda9d5da6814661828adabe8a09f9d01aefb Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 26 Mar 2026 09:14:59 +0000 Subject: network/receivepack: Rename from receivepack --- network/receivepack/service/command.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 network/receivepack/service/command.go (limited to 'network/receivepack/service/command.go') diff --git a/network/receivepack/service/command.go b/network/receivepack/service/command.go new file mode 100644 index 00000000..0fd8961e --- /dev/null +++ b/network/receivepack/service/command.go @@ -0,0 +1,32 @@ +package service + +import objectid "codeberg.org/lindenii/furgit/object/id" + +// Command is one protocol-independent requested ref update. +type Command struct { + OldID objectid.ObjectID + NewID objectid.ObjectID + Name string +} + +func fillCommandErrors(result *Result, commands []Command, errText string) { + for _, command := range commands { + result.Commands = append(result.Commands, CommandResult{ + Name: command.Name, + Error: errText, + RefName: command.Name, + OldID: objectIDPointer(command.OldID), + NewID: objectIDPointer(command.NewID), + }) + } +} + +func isDelete(command Command) bool { + return command.NewID == objectid.Zero(command.NewID.Algorithm()) +} + +func objectIDPointer(id objectid.ObjectID) *objectid.ObjectID { + out := id + + return &out +} -- cgit v1.3.1-10-gc9f91