summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-05-13 14:05:54 -0700
committerJunio C Hamano <gitster@pobox.com>2015-05-13 14:05:54 -0700
commitc1c4a878bb70b6f46550ab370bba320a3a5dda70 (patch)
tree6b39e419dc0505cb07bd0c3f76fdc4fc46e098b9 /object.c
parent21b56b92590e68fde07abbba7676c91cd883031b (diff)
parentb7994af0f92e6cf150544aebe3c3fc526faaf2c3 (diff)
downloadgit-c1c4a878bb70b6f46550ab370bba320a3a5dda70.tar.gz
Merge branch 'jk/type-from-string-gently' into maint
"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
Diffstat (limited to 'object.c')
-rw-r--r--object.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/object.c b/object.c
index 23d6c96719..980ac5fcdf 100644
--- a/object.c
+++ b/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)