Adapt original getHeadRev implementation to support wildcards