match-trees: convert several leaf functions to use struct object_id