Make sure that Scala UID is always a git hash

The value of `SCALA_GIT_HASH` doesn't have to be a hash. It can be
a branch or a tag too.
Makes sure that we are using a hash as `UID`.