commit-graph: extract copy_oids_to_commits()