mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
Bump go-git
This commit is contained in:
17
vendor/github.com/jesseduffield/go-git/v5/plumbing/hash.go
generated
vendored
17
vendor/github.com/jesseduffield/go-git/v5/plumbing/hash.go
generated
vendored
@ -2,15 +2,15 @@ package plumbing
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/sha1"
|
||||
"encoding/hex"
|
||||
"hash"
|
||||
"sort"
|
||||
"strconv"
|
||||
|
||||
"github.com/jesseduffield/go-git/v5/plumbing/hash"
|
||||
)
|
||||
|
||||
// Hash SHA1 hashed content
|
||||
type Hash [20]byte
|
||||
type Hash [hash.Size]byte
|
||||
|
||||
// ZeroHash is Hash with value zero
|
||||
var ZeroHash Hash
|
||||
@ -46,7 +46,7 @@ type Hasher struct {
|
||||
}
|
||||
|
||||
func NewHasher(t ObjectType, size int64) Hasher {
|
||||
h := Hasher{sha1.New()}
|
||||
h := Hasher{hash.New(hash.CryptoType)}
|
||||
h.Write(t.Bytes())
|
||||
h.Write([]byte(" "))
|
||||
h.Write([]byte(strconv.FormatInt(size, 10)))
|
||||
@ -74,10 +74,11 @@ func (p HashSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
|
||||
|
||||
// IsHash returns true if the given string is a valid hash.
|
||||
func IsHash(s string) bool {
|
||||
if len(s) != 40 {
|
||||
switch len(s) {
|
||||
case hash.HexSize:
|
||||
_, err := hex.DecodeString(s)
|
||||
return err == nil
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
||||
_, err := hex.DecodeString(s)
|
||||
return err == nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user