fix generation of short revision hashes in test_perf
This PR fixes the broken generation of short revision hashes of test_perf.py described in #4654.

@y-p ?
 Thanks for the ping. I've seen this before, it's fairly rare, due to a hash prefix collision.
That code was a kludge to accommodate vbench's use of abbreviated hashes internally.
Looking at the code again, those come from `git log  --pretty=format:%h` which indeed
corresponds to the "short" hash employed here, rather then to simply truncating. 

cherry picked to master as d53e4fd. Thanks @wuan.
