Commit 27078e582ed9deee6ed0dac1f8ecabb6bac66c67

Edward Thomson 2017-12-18T23:11:42

odb_loose: test read_header on large blobs Test that we can read_header on large blobs. This should succeed on all platforms since we read only a few bytes into memory to be able to parse the header.

diff --git a/tests/odb/largefiles.c b/tests/odb/largefiles.c
index 5a1ec5e..762f184 100644
--- a/tests/odb/largefiles.c
+++ b/tests/odb/largefiles.c
@@ -158,3 +158,19 @@ void test_odb_largefiles__read_into_memory_rejected_on_32bit(void)
 
 	git_odb_object_free(obj);
 }
+
+void test_odb_largefiles__read_header(void)
+{
+	git_oid oid;
+	size_t len;
+	git_otype type;
+
+	if (!cl_is_env_set("GITTEST_INVASIVE_FS_SIZE"))
+		cl_skip();
+
+	writefile(&oid);
+	cl_git_pass(git_odb_read_header(&len, &type, odb, &oid));
+
+	cl_assert_equal_sz(LARGEFILE_SIZE, len);
+	cl_assert_equal_i(GIT_OBJ_BLOB, type);
+}