Make it possible to clone a specific ref
The GitLab CI runners want to fetch and check out a specific ref to run the tests against.
Currently it does something like this:
git init repo
git -C repo remote add origin path/to/repo.git
git -C repo fetch origin refs/merge-requests/6509/merge
git switch --detach FETCH_HEAD
It doesn't matter whether the GIT_STRATEGY
is fetch
or clone
, in both cases git-fetch(1)
is used, because git-clone(1)
simply doesn't support cloning a single ref. git-clone(1)
has option --single-branch
and --branch=<branch-name>
, but it's not possible specify a non-branch ref.
Proposal
Add single ref cloning support to git-clone(1)
. The correct design of the name and format of arguments is still to be decided.
Edited by Toon Claes