The main gitshed functionality.

Pulls together code from previous commits.

The main() wrapper, BUILD files etc. will follow shortly.
You're right, I got confused with all of the paths. I *think* we still should check that target_abspath doesn't exist defensively so that if it does—probably because there was a bug somewhere else—we can give a better error message to the user