write_loose_object: convert to strbuf