As mentioned in #buildstream it looks like most of the failures are coming from git, leading to an assumption that it could be down to the host git config/version and the recent changes made to the git plugin.
Regardless of whether or not it ought to have an effect, that version of git is over five years old, so there'll be a LOT to trawl through if we were to try and determine changes in behaviour from the git side. As such, we probably need to break down some of the failing tests more carefully.
For what it's worth, using the centos dockerfile I've been able to see the same tests failures. Sadly I've not had enough time to poke at the git tag / describe changes that have caused this in buildtstream as of yet
It's outputting that there are 3 commits after the tag
when the test expects it to say there are 2.
The test produces a tree like:
I | F1 ← refs/tags/tag1 / \F3 F2 ← refs/heads/branch2, refs/tags/tag2 \ / M ← master, HEAD
Frankly 1 would be my interpretation of what the answer should be,
but the algorithm is defined as the commits reachable from HEAD
minus the commits reachable from tag2,
so the two commits it's saying are after tag2 are F3 and M.
(git log has the --ancestry-path option for limiting it to the path
between the listed commits, which if describe had a similar option
would limit the "commits after" to 1.)
In the version of git running in CentOS, the produced tree looks like:
F1 ← refs/tags/tag1 /F3 F2 ← refs/tags/tag2 \ / M ← master, HEAD
Since the link between F2 and F1 is missing
it doesn't know that F1 is reachable from F2,
so it is included in the count.
At a guess I'd say that improvements to
the shallow commit traversal algorithm since the version in CentOS
mean that it doesn't matter that F2 shouldn't have been marked
as a shallow commit.
Adding an extra step to check all the shallow commits
to see if all of their parents are in the included tree
and not write them as shallow if they are.
This still has the edge case of shallow commits
who only have some of their parents included,
which is presumably why the algorithm was changed since that version
to only omit parents in shallow commits if that parent is missing.
(as an aside, the current algorithm for walking the tree
can include commits that are not part of the required history
since it is not using --ancestry-path).
Ironically this has also proven that the current implementation is also including commit history that it does not need to, since the commit that the missing tag would point to is still present, so the number of commits remains the same.
Given the lack of --first-parent isn't treated as a fatal error, and instead produces a different cache key I'm assuming this behaviour is intentional, so I'm going to amend the test suite to check whether --first-parent is missing and deal with tag1 not being there.
Given the lack of --first-parent isn't treated as a fatal error, and instead produces a different cache key I'm assuming this behaviour is intentional, so I'm going to amend the test suite to check whether --first-parent is missing and deal with tag1 not being there.
I'm not sure we should have a different key there. I might be misunderstanding or this might be an oversight but it might be good to check the intent with the author of this part :)
@valentindavid we could do with your input, since it determines whether to accept the change, or require a newer version of git, and not support that version of CentOS.
The reason we ignore errors originally is because there might be no tag using first parents. So the silent error here was not intended for that purpose.
However, this code happens only during tracking. So reproduction is not an issue here. If you track with the wrong git version, you still build what is explicitly saved in the element or in project.refs. What we build is exactly what is in the element and project.refs.
So yes. We can just ignore those tests when git version detected to be too old.
Other solutions:
Fail track when git version is too old.
Warn when tracking and git version is too old.
Disable git describe feature when git version is too old.
@richardmaw-codethink I have fixed the issue with too many commits included in !1069 (merged). I have also fixed another bug I came across while testing. We do not track properly when the HEAD is tagged. Could you review it?
I submitted !1085 (merged) to make the test suite pass, and included !1053 (closed) to test whether it works generally or just worked in my own container.