From cbf923e87bca0f50c2c01a60ccf544b63c365e98 Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Wed, 13 Dec 2023 21:02:00 +0000 Subject: Abstract hash function usage (#28138) Refactor Hash interfaces and centralize hash function. This will allow easier introduction of different hash function later on. This forms the "no-op" part of the SHA256 enablement patch. --- cmd/hook.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/hook.go b/cmd/hook.go index f38fd8831b..624569cdfa 100644 --- a/cmd/hook.go +++ b/cmd/hook.go @@ -376,7 +376,9 @@ Gitea or set your environment appropriately.`, "") oldCommitIDs[count] = string(fields[0]) newCommitIDs[count] = string(fields[1]) refFullNames[count] = git.RefName(fields[2]) - if refFullNames[count] == git.BranchPrefix+"master" && newCommitIDs[count] != git.EmptySHA && count == total { + + commitID, _ := git.IDFromString(newCommitIDs[count]) + if refFullNames[count] == git.BranchPrefix+"master" && !commitID.IsZero() && count == total { masterPushed = true } count++ @@ -669,7 +671,8 @@ Gitea or set your environment appropriately.`, "") if err != nil { return err } - if rs.OldOID != git.EmptySHA { + commitID, _ := git.IDFromString(rs.OldOID) + if !commitID.IsZero() { err = writeDataPktLine(ctx, os.Stdout, []byte("option old-oid "+rs.OldOID)) if err != nil { return err -- cgit v1.2.3