Fast implementation of Git in pure Go codeberg.org/lindenii/furgit
git go
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

network/receivepack/service: Some cleanups

Runxi Yu 31f6ea68 7d819fea

+14 -24
+2 -2
network/receivepack/service/apply.go
··· 127 127 return CommandResult{ 128 128 Name: command.Name, 129 129 RefName: command.Name, 130 - OldID: objectIDPointer(command.OldID), 131 - NewID: objectIDPointer(command.NewID), 130 + OldID: new(command.OldID), 131 + NewID: new(command.NewID), 132 132 } 133 133 }
+2 -8
network/receivepack/service/command.go
··· 15 15 Name: command.Name, 16 16 Error: errText, 17 17 RefName: command.Name, 18 - OldID: objectIDPointer(command.OldID), 19 - NewID: objectIDPointer(command.NewID), 18 + OldID: new(command.OldID), 19 + NewID: new(command.NewID), 20 20 }) 21 21 } 22 22 } ··· 24 24 func isDelete(command Command) bool { 25 25 return command.NewID == command.NewID.Algorithm().Zero() 26 26 } 27 - 28 - func objectIDPointer(id objectid.ObjectID) *objectid.ObjectID { 29 - out := id 30 - 31 - return &out 32 - }
-13
network/receivepack/service/hook_apply.go
··· 1 1 package service 2 2 3 - func buildHookUpdates(commands []Command) []RefUpdate { 4 - updates := make([]RefUpdate, 0, len(commands)) 5 - for _, command := range commands { 6 - updates = append(updates, RefUpdate{ 7 - Name: command.Name, 8 - OldID: command.OldID, 9 - NewID: command.NewID, 10 - }) 11 - } 12 - 13 - return updates 14 - } 15 - 16 3 func resultForHookRejection(command Command, message string) CommandResult { 17 4 result := successCommandResult(command) 18 5 result.Error = message
+10 -1
network/receivepack/service/run_hook.go
··· 33 33 34 34 utils.BestEffortFprintf(service.opts.Progress, "running hooks...\r") 35 35 36 + updates := make([]RefUpdate, 0, len(commands)) 37 + for _, command := range commands { 38 + updates = append(updates, RefUpdate{ 39 + Name: command.Name, 40 + OldID: command.OldID, 41 + NewID: command.NewID, 42 + }) 43 + } 44 + 36 45 decisions, err := service.opts.Hook(ctx, HookRequest{ 37 46 Refs: service.opts.Refs, 38 47 ExistingObjects: service.opts.ExistingObjects, 39 48 QuarantinedObjects: quarantinedObjects, 40 49 CommitGraph: service.opts.CommitGraph, 41 - Updates: buildHookUpdates(commands), 50 + Updates: updates, 42 51 PushOptions: append([]string(nil), req.PushOptions...), 43 52 IO: service.opts.HookIO, 44 53 })