send-pack.c: add --staged-push support

Add support for performing staged pushes.
Add staged-send-refs and staged-receive-refs utilities for client and
server side committing the ref updates in a staged update.

Staged push
-----------
When a staged push is performed all required objects will be uploaded to the
server but the refs that are pushed will instead be replaced by temporary
refnames under the refs/hidden/staging directory.
It is expected that a server using staged pushes will be configured to
have refs/hidden as hidden refs so that external parties can not
see the temporary staging area or which sha1 objects they refer to.

Additionally we store in the ~/.gitstaging file the ref updates that are
required for deleting the temporary ref used and to update the original
ref.

   git push --staged-push origin master:master

Committing a staged push
------------------------
Once objects are uploaded and the refs are held in the staging area you can use the staged-send-refs command to commit the ref updates on the server.
Since this operation only involves ref updates and it is assumed that all
involved objects are already held on the server it is expected that this
operation will be very fast.

   git staged-send-refs

Usecase: preload a repository before a release
----------------------------------------------
One use case for staged pushes is for handling major release of large
repositories. A staged push can be used here to first push all the
objects to the server, an operation that may take significant time for very
large repositories. Since this is a staged push we only want the objects
to be uploaded to the server but we do not want any of these objects to become
visible to end users yet.
At a later stage when we announce the new version of the software we can use
  git staged-send-refs
to just update the refs on the server and make the objects visible.
Since staged-send-refs only update refs but relies on that the objects must
already exist on the server we are guaranteed that the operation will be fast.

We can thus preload the objects to the server and then very quickly make
the objects visible once we make a public announcement of the new release.

Usecase: atomic push across multiple repositories
-------------------------------------------------
The staged-send-refs protocol supports performing atomic ref updates across
multiple repositories (for those ref backends where this is possible).
This makes it possible to queue up several pushes to several different
repositories and then commit the actual ref update as one single atomic
transaction. This can be useful for situations where you perform an API change
in one repository for a library and then have to do corresponding changes
in any affected consumer of that library.

Example:
  1, cd to repo for library
  2, git push --staged-push ...
  3, cd to repo for consumer
  4, git push --staged-push

  5, git staged-send-refs --atomic-push-all

Change-Id: Id54018388ae7d9c3283576b8dff23ed46557a36b
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
documentation: document the staged refs update protocol

Add protocol description for the protocol used to perform a staged
refs update.

Change-Id: I3621d6b9829e05a25e4f6e08a905c9e7cbccc1e7
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>