install --HEAD, keep the .git directory for building.

Some packages (e.g. `opam`) embed checkout commit hashes in their build artefacts when they are built from their development repository. This makes `--HEAD` installs more tracable.

This patch replaces the `checkout-index` invocations by a regular `clone`.