gittest: Refactorings to make the package hash-clean
This MR contains refactorings to make the gittest package hash-clean so that its tests pass both with SHA1 and SHA256. This is an initial building block to actually convert all of our other packages to become hash-clean over time.