Turn get_current_sha into a function

So it can be reused.