stash: fix false positive in the invalid ref test.