We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a6433aa commit 47fedfaCopy full SHA for 47fedfa
modules/git/object_id.go
@@ -37,14 +37,9 @@ var _ ObjectID = &Sha1Hash{}
37
38
// EmptyObjectID creates a new ObjectID from an object format hash name
39
func EmptyObjectID(objectFormatName string) (ObjectID, error) {
40
- if objectFormatName == "" {
41
- return Sha1ObjectFormat.EmptyObjectID(), nil
42
- }
43
- objectFormatName = strings.ToLower(objectFormatName)
44
- for _, objectFormat := range SupportedObjectFormats {
45
- if objectFormat.Name() == objectFormatName {
46
- return objectFormat.EmptyObjectID(), nil
47
+ objectFormat := ObjectFormatFromName(objectFormatName)
+ if objectFormat != nil {
+ return objectFormat.EmptyObjectID(), nil
48
}
49
50
return nil, errors.New("unsupported hash type")
0 commit comments