Merge branch 'jk/type-from-string-gently'
"git cat-file bl $blob" failed to barf even though there is no object type that is "bl". * jk/type-from-string-gently: type_from_string_gently: make sure length matches
This commit is contained in:
3
object.c
3
object.c
@ -41,7 +41,8 @@ int type_from_string_gently(const char *str, ssize_t len, int gentle)
|
||||
len = strlen(str);
|
||||
|
||||
for (i = 1; i < ARRAY_SIZE(object_type_strings); i++)
|
||||
if (!strncmp(str, object_type_strings[i], len))
|
||||
if (!strncmp(str, object_type_strings[i], len) &&
|
||||
object_type_strings[i][len] == '\0')
|
||||
return i;
|
||||
|
||||
if (gentle)
|
||||
|
||||
Reference in New Issue
Block a user