Perhaps this should be the last check, as it will match a branch that happens to be alphanumeric and 40 chars. Pretty edge case, but checking if it is branch first is less likely to accidentally match imo.