Turn get_current_sha into a function

So it can be reused.

Fixes #441