Prefer exact basename matches over shallow matches