Merge pull request #580 from erizocosmico/perf/refs-iter-once

remote: iterate over references only once