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

Add "squash merge" support to merge API #8464

Merged
merged 6 commits into from
Jan 6, 2025

Conversation

arielshaqed
Copy link
Contributor

Squashing really just means removing the source branch as a parent of the
resulting commit.

Fixes #7382.

Copy link

github-actions bot commented Jan 5, 2025

♻️ PR Preview 9980ba3 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@arielshaqed
Copy link
Contributor Author

arielshaqed commented Jan 5, 2025

This turned out to be a really small feature, about 3 lines of actual code. Useful e.g. for this, required for delta-rs support.

@arielshaqed arielshaqed added area/API Improvements or additions to the API area/integrations include-changelog PR description should be included in next release changelog feature labels Jan 5, 2025
@arielshaqed arielshaqed changed the title Add "squash merge" support to merge APIgen Add "squash merge" support to merge API Jan 5, 2025
Copy link

github-actions bot commented Jan 5, 2025

E2E Test Results - DynamoDB Local - Local Block Adapter

13 passed

Copy link

github-actions bot commented Jan 5, 2025

E2E Test Results - Quickstart

11 passed

@arielshaqed
Copy link
Contributor Author

@ion-elgreco I think this will help your use-case.

@ion-elgreco
Copy link

@ion-elgreco I think this will help your use-case.

Awesome! 🙏😎

Copy link
Contributor

@Jonathan-Rosenberg Jonathan-Rosenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to understand a bit further:
Examining Git's squash semantics, it looks a bit different from the suggested change. According to Git, the changes from the list of commits being squashed are combined to a single commit, thus rewriting the history. That means that I cannot traverse the changes throughout the commits because they all exist in a single commit.
Are those the semantics expressed in this feature? If so, how are they reflected in the suggested implementation?

@arielshaqed
Copy link
Contributor Author

I need to understand a bit further: Examining Git's squash semantics, it looks a bit different from the suggested change. According to Git, the changes from the list of commits being squashed are combined to a single commit, thus rewriting the history. That means that I cannot traverse the changes throughout the commits because they all exist in a single commit. Are those the semantics expressed in this feature? If so, how are they reflected in the suggested implementation?

You're right but so am I! Git merge --squash prepares a commit but does not actually commit it. So it's a bit like --no-commit would be. This API is like more like git merge --squash ; git commit.

This PR is more like GitHub squash-merge! You get a new commit on the destination branch, with all the changes on the search branch from the merge base. There is no way to traverse from the destination branch to those changes - the source branch parent is missing.

@ion-elgreco is this what you want, or do you actually want the Git "bring-me-the-changes-but-only-stage-them" behaviour?

@arielshaqed arielshaqed force-pushed the feature/7382-squashable-merges branch from fedacd4 to 4ba04c4 Compare January 6, 2025 13:11
@ion-elgreco
Copy link

ion-elgreco commented Jan 6, 2025

@arielshaqed actually both things are useful, however currently I was mainly looking for a GitHub squash-merge like you say!

An additional commit API though that can do squash from head, so all new commits since it was branched off to squash into one commit can be practical for other usecases

@Jonathan-Rosenberg
Copy link
Contributor

@arielshaqed Got it! Thank you.
Will now continue the review...

Copy link
Contributor

@Jonathan-Rosenberg Jonathan-Rosenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.
Looks very good, although a sassy developer might be surprised to get the GitHub version of a squash merge rather than the Git version. You might add some clarification in the docs (description) on that, and you might not 😀
I've also noticed that lakeCTL isn't updated with the new capability and it might be a quick win here (of course that it's not a part of the PR, but releasing a version with the client already updated can be nice)...

@arielshaqed arielshaqed force-pushed the feature/7382-squashable-merges branch 6 times, most recently from efb1d18 to 4b8a626 Compare January 6, 2025 15:11
@arielshaqed arielshaqed force-pushed the feature/7382-squashable-merges branch 6 times, most recently from cc776f8 to e16993e Compare January 6, 2025 17:19
@arielshaqed arielshaqed force-pushed the feature/7382-squashable-merges branch from e16993e to 9980ba3 Compare January 6, 2025 17:43
@arielshaqed
Copy link
Contributor Author

Great, thanks!

Thank you. Looks very good, although a sassy developer might be surprised to get the GitHub version of a squash merge rather than the Git version. You might add some clarification in the docs (description) on that, and you might not 😀

Done! 9ca1331

I've also noticed that lakeCTL isn't updated with the new capability and it might be a quick win here (of course that it's not a part of the PR, but releasing a version with the client already updated can be nice)...

Did that too, in 54dbde3. I even added a lakectl test as 9980ba3; it took a while but is somewhat cool.

Pulling once tests pass.

@arielshaqed arielshaqed enabled auto-merge (squash) January 6, 2025 17:44
@arielshaqed arielshaqed merged commit 418fc9f into master Jan 6, 2025
40 checks passed
@arielshaqed arielshaqed deleted the feature/7382-squashable-merges branch January 6, 2025 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/API Improvements or additions to the API area/integrations feature include-changelog PR description should be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

squash commits
3 participants