summaryrefslogtreecommitdiff
path: root/src/odb.c
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2012-09-13 09:24:12 -0700
committerVicent Martí <vicent@github.com>2012-09-13 09:24:12 -0700
commit9be2261eaae74552aaa9d568e663292f4382e141 (patch)
treefe9711595f4fe21e86989efcbd374ddb7bb5d157 /src/odb.c
parent45c4697c48e50951a383f93d63ad0c192915df8c (diff)
parenta13fb55afdbf9d74c3d4b6aa76476a005da49486 (diff)
downloadlibgit2-9be2261eaae74552aaa9d568e663292f4382e141.tar.gz
Merge pull request #927 from arrbee/hashfile-with-filters
Add git_repository_hashfile to hash with filters
Diffstat (limited to 'src/odb.c')
-rw-r--r--src/odb.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/odb.c b/src/odb.c
index c027c12c3..29c56a5bf 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -117,6 +117,11 @@ int git_odb__hashfd(git_oid *out, git_file fd, size_t size, git_otype type)
git_hash_ctx *ctx;
ssize_t read_len = -1;
+ if (!git_object_typeisloose(type)) {
+ giterr_set(GITERR_INVALID, "Invalid object type for hash");
+ return -1;
+ }
+
hdr_len = format_object_header(hdr, sizeof(hdr), size, type);
ctx = git_hash_new_ctx();