Execute Git commands with AccessPath.GIT

Since 53b0e7ffb506 ("Require branch deletion permission for pushes
over HTTP") branch deletion or creation over ssh:// by Git push
failed, because the AccessPath was specified wrong.  We need to
force a temporary change for the current command to AccessPath.GIT,
rather than the default of AccessPath.SSH_COMMAND.

Doing this is a bit ugly, as we have to build up a temporary
SshSession, and also a temporary SshScope.Context to point to that
temporary session.  Installing the temporary context before we call
the startThread method will ensure the background worker properly
inherits our context object, and therefore our identity as a Git
based command.

Change-Id: I6cfc91966fffa2c5054ae6d65f6ac57dc751a4fc
Signed-off-by: Shawn O. Pearce <sop@google.com>
4 files changed