diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-05-05 21:00:29 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-05-05 21:00:29 -0700 |
commit | 1156097296e584bd05a9feeb14cb9fcf98093dc8 (patch) | |
tree | 8ab64f854692cef634e05fd2b4ff706c927ffa10 /object.c | |
parent | b9032b284fb46f3e4994e6dc3cbb0c4993cdd3fb (diff) | |
parent | b7994af0f92e6cf150544aebe3c3fc526faaf2c3 (diff) | |
download | git-1156097296e584bd05a9feeb14cb9fcf98093dc8.tar.gz |
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
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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) |