Rearrange code to allow SHA1 to default to origin HEAD
Rearrange code to allow SHA1 to default to origin HEAD

This allows you to omit the --sha1 parameter even if the current
directory isn't the repository, and fallback to whatever the remote HEAD
is (i.e. usually master)

surf-build/surf,surf-build/surf,surf-build/surf,surf-build/surf