cmd/gitmirror: try to fetch unknown revs from remote

If new commits are submitted to the remote repository while gitmirror
is running, gitmirror won't be able to find them when a user asks for
that commit to be exported.

If a request asks for an unknown commit, attempt to fetch it
on-demand from the remote and serve from there.

I checked that this worked by starting a local gitmirror, verifying
the commit was not present in the local repo, submitting a changeset,
asking for that commit, and verifying that gitmirror fetched the
remote commit to serve it.

Adds a very basic test for the archive functionality that won't go
over the network or hit the disk.

Fixes golang/go#19166.

Change-Id: I1ad017b9c8cd258849585c091122c889ea656017
Reviewed-on: https://go-review.googlesource.com/37225
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2 files changed