filter-branch: work correctly with ambiguous refnames