filter-branch: fix errors caused by refs that point at non-committish