Skip to content

Commit 47fedfa

Browse files
committed
Simple the code
1 parent a6433aa commit 47fedfa

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

modules/git/object_id.go

+3-8
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,9 @@ var _ ObjectID = &Sha1Hash{}
3737

3838
// EmptyObjectID creates a new ObjectID from an object format hash name
3939
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-
}
40+
objectFormat := ObjectFormatFromName(objectFormatName)
41+
if objectFormat != nil {
42+
return objectFormat.EmptyObjectID(), nil
4843
}
4944

5045
return nil, errors.New("unsupported hash type")

0 commit comments

Comments
 (0)