sha1_file: add read_loose_object() function