Add squash-merging flag to transactions #313
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
lakeFS v1.48.0 added squash-merging, which, as the name suggests, merges a source branch into a target branch by squashing the additional history into a single commit (which is also actually the merge commit in lakeFS).
The interesting thing is that it enables squashing by default, which changes the user-facing behavior of our (merge-based) transactions, and also all other merges done via
tx.merge()
.This broke some of our transaction tests, which try to assert correct behavior by counting commits since branch creation, and verify by commit message.
This commit fixes the tests by introducing a new
squash
flag to the transaction class, which controls squash-merging of the transaction branch and any other branches/refs merged viatx.merge()
.Interestingly, no special logic is needed to backport the extra keyword argument to
Reference.merge_into()
- I suspect that this is some pydantic compatibility detail.I tested this change with several server versions other than
latest/v1.48.0
, namely v1.41.0 and v1.47.0. No idea why this works, @AdrianoKF knows pydantic better than me.