fix reflog failing to properly refresh

This commit is contained in:
Jesse Duffield 2022-01-26 10:34:56 +11:00
parent f4ddf2f0d4
commit ce3bcfe37c
16 changed files with 1196 additions and 3 deletions

28
vendor/github.com/sanity-io/litter/util.go generated vendored Normal file
View file

@ -0,0 +1,28 @@
package litter
import (
"reflect"
)
// deInterface returns values inside of non-nil interfaces when possible.
// This is useful for data types like structs, arrays, slices, and maps which
// can contain varying types packed inside an interface.
func deInterface(v reflect.Value) reflect.Value {
if v.Kind() == reflect.Interface && !v.IsNil() {
v = v.Elem()
}
return v
}
func isPointerValue(v reflect.Value) bool {
switch v.Kind() {
case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.Slice, reflect.UnsafePointer:
return true
}
return false
}
func isZeroValue(v reflect.Value) bool {
return (isPointerValue(v) && v.IsNil()) ||
(v.IsValid() && v.CanInterface() && reflect.DeepEqual(v.Interface(), reflect.Zero(v.Type()).Interface()))
}