ls-files: convert overlay_tree_on_cache to take an index