Merge branch 'jk/squelch-missing-link-warning-for-unreachable' into maint
[gitweb.git] / object.c
index 23d6c9671904cfe273fc16de8a4d2db56b91c3b4..980ac5fcdfa7654667c9902aa56407f1ce7053ba 100644 (file)
--- 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)