Pass context in via argument instead of using global.

Because git checkout doesn't always do what you want it to. Or to be
more correct, you don't always ask it to do the same thing that you
think you're asking it to do.