Tests and fixes for dereferencing tags in Repository.resolve()