Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: correctly handle merge commits when calculating a build tag #226

Conversation

isaac-io
Copy link
Contributor

@isaac-io isaac-io commented Nov 9, 2022

Merge commits were incorrectly handled due to the named use of git rev-list, which does not give an ancestry path as I expected, but simply a list of unique commits between the two refs.

Additionally, the check for the base tag was wrong in the face of merge commits, since a tag could be an ancestor through a merge commit, but not be the actual base of the branch.

Both of these issues resulted in an incorrect tag being calculated, as well as a build slowdown due to the iteration over all of the commits from the other parent of the merge commit, which is unneeded. After the changes in this PR, running the script on the branch mentioned in the linked issue (#225) results in the following output:

$ build_tools/spdb_get_build_tag.py
warning: current version doesn't match base release tag (current=2.1.0, tag=2.0.0)
(tag:2.0.0)-(main+34)-(#mrambacher/merge-7.8+10)

The reason for the mismatch is that the 2.1.0 tag was imported through a merge rather than being a direct base, so in order to include all of the changes in the branch, 2.0.0 had to be considered the base.

While at it, add logic for caching the build tag in order to speed up builds when the checked-out git tree hasn't changed.

)

Merge commits were incorrectly handled due to the named use of `git rev-list`,
which does not give an ancestry path as I expected, but simply a list of
unique commits between the two refs.

Additionally, the check for the base tag was wrong in the face of merge
commits, since a tag could be an ancestor through a merge commit, but not
be the actual base of the branch.

Both of these issues resulted in an incorrect tag being calculated, as well
as a build slowdown due to the iteration over all of the commits from the
other parent of the merge commit, which is unneeded.

While at it, add logic for caching the build tag in order to speed up
builds when the checked-out git tree hasn't changed.
@isaac-io isaac-io merged commit 93172c8 into main Nov 12, 2022
@isaac-io isaac-io deleted the 225-build-merges-are-incorrectly-handled-when-calculating-a-build-tag branch November 12, 2022 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

build: merges are incorrectly handled when calculating a build tag
2 participants