git-cache-proxy: Handle extra-parameters for git protocol v2
This patch allows git clients to communicate with the cache with the git
protocol version 2.
Even though the only described extra-parameters is "version=2", the protocol
describe how extra parameters are handled. `git-upload-pack` will just ignore
the ones it doesn't know about.
The first line of the git protocol is described at
https://github.com/git/git/blob/master/Documentation/gitprotocol-pack.txt
and "extra-parameters" has been implemented here.
These parameters can be passed down to `git-upload-pack` via
the environment variable GIT_PROTOCOL like a clone over ssh would do
(if the ssh server allows GIT_PROTOCOL env variables).
GIT_PROTOCOL is described in
https://github.com/git/git/blob/master/Documentation/git.txt
The reason we need to be able to handle V2 is to allow a shallow clone with an
sha1. Shallow clone seems to only work with a known ref with the v1 of the
protocol.
Example of command that fails when QEMU v8.1 tries to clone the subproject
"dtc" via meson:
git fetch --depth 1 origin
b6910bec11614980a21e46fbccc35934b671bd81
This command also fails when git isn't able to send the envvar GIT_PROTOCOL,
like when cloning over ssh (without git-cache-proxy).
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>