It turns out older versions of git cannot properly check out a commit
if the ref that points to it was not a normal one (branch or tag).
So, we work around this case by detecting it add adding a fake
tag. Also, we change the fake ref we use for commit-only references
to be a regular branch and not a special one for the same reason.
This fixes https://github.com/flatpak/flatpak/issues/1133Closes: #52
Approved by: alexlarsson
Some manifest (cx.ring.RingGnome) had a git commit id that
was only tip of a non-branch ref (refs/changes/51/8051/8), which
was not cloned by a regular clone, so we need to switch to
a clone --mirror.
Closes: #50
Approved by: alexlarsson
When downloading a git repo we try to do a shallow (depth=1) fetch of
only the specified target. This normally works fine for branches and
tags, but if the commit is a raw SHA1 then it fails, because we can
only request refs from the remote.
We handle this by doing an ls-remote and seeing if the specified
target is either a (possilby partial) ref, or a commit id that a
remote ref is pointing at. If it is, we pull that ref only. If not,
then we fall back to a full fetch.
I believe this is the best we can do to fix
https://github.com/flatpak/flatpak-builder/issues/6Closes: #47
Approved by: alexlarsson
When doing a shallow clone when bundling git sources we sometimes need
to create a ref in the source repo. This changes the ref used from
refs/heads/flatpak-builder/ref-$REF to refs/flatpak/ref-$REF.
In other words, it uses a custom ref rather than a branch, which has
less chance of conflicting with some existing branch.
Closes: #47
Approved by: alexlarsson
It seems we have to specify
git fetch --depth 1 origin $ref:$ref
instead of
git fetch --depth 1 origin $ref
because on older versions of git (1.8.3 at least) this otherwise just
sets FETCH_HEAD, rather than $ref in the fetching repo.
There is no need to bundle the entire history in a git repo.
Instead we only bundle shallow versions of all the branches/tags/commit
that we reference.
For directly specified commit ids we can't really shallow-clone those,
so we create fake tags in the mirrored repo.