summaryrefslogtreecommitdiff
path: root/builtin-commit-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-commit-tree.c')
-rw-r--r--builtin-commit-tree.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/builtin-commit-tree.c b/builtin-commit-tree.c
index 2a818a0a2c..04f61d5101 100644
--- a/builtin-commit-tree.c
+++ b/builtin-commit-tree.c
@@ -47,11 +47,10 @@ static void add_buffer(char **bufp, unsigned int *sizep, const char *fmt, ...)
static void check_valid(unsigned char *sha1, const char *expect)
{
- char type[20];
-
- if (sha1_object_info(sha1, type, NULL))
+ enum object_type type = sha1_object_info(sha1, NULL);
+ if (type < 0)
die("%s is not a valid object", sha1_to_hex(sha1));
- if (expect && strcmp(type, expect))
+ if (expect && type != type_from_string(expect))
die("%s is not a valid '%s' object", sha1_to_hex(sha1),
expect);
}