-
Notifications
You must be signed in to change notification settings - Fork 31
TOOL-21469 Allow empty commits when cherry-picking in kernel repos #290
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
TOOL-21469 Allow empty commits when cherry-picking in kernel repos #290
Conversation
5a39ba1
to
8262906
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have my doubts about this being a good idea.. can you add some information about why you think we want to do this?
@prakashsurya I added some info |
I don't see any reason to have this empty commit in that repository:
Why do we want/need it? Can't we just remove it, and then we don't need the changes in this PR.. I'm not sure why we added an empty commit, vs. updating that repository to just remove this empty commit, and the merge commit..? |
The only reason to create it was to be able to open a PR in order to get approvals so that the corrected git history could be pushed. How would I go about removing a commit without a PR? I tried and the branch protections didn't let me:
|
What we've done in the past when a merge commit is accidentally added.. is we rewrite the history, such that merge commit is no longer there.. open a PR with the new "fixed" history.. and then force push to merge the PR with Once you have the PR with approvals, the |
This is what I did, with the only caveat that each time I would open a PR without an empty commit, Github would automatically close it: |
I think, previously, in the process of removing the merge commit, we'd "rewrite" the commit we want to keep.. resulting in a different commit hash.. which lets the PR process work.. e.g. see here: delphix/linux-kernel-aws#43 I've removed the empty commit, and also did a FWIW, here's the history for that PR:
|
What are your reservations with this change? I don't mind discarding this PR but I am curious why we shouldn't allow cherry-picking empty commits |
I'm not necessarily against it.. but I can't think of any good reason why we'd want to maintain empty commits in the history.. the one case that sparked this PR, IMO at least, isn't a good reason, since we can just remove the empty commit and avoid the problem entirely.. I think the empty commit just makes things more complicated.. e.g. if a future developer sees it, and is working on moving our patch stack to a new kernel version (like I just did, moving to the 5.15 kernel).. should they port it to the new kernel version? or drop it? why have it to begin with? IMO, it's unclear, and just makes things more difficult to reason about.. So then.. if the general rule (or, perhaps it's just my opinion) should be not to preserve empty commits in our patch stack.. I don't think this change is necessary.. But.. with that said, I'm OK landing this.. I'm just doubtful that having and preserving empty commits in our patch stack provides us any value.. if you think this change is useful, I don't feel strongly, I'm OK getting others to approve and land it.. |
Problem
Recently, a merge commit was pushed to the linux-kernel-aws repo
because the author clicked the "Create a merge commit" option to
merge their PR. This caused the
update-package
jobs to fail with:To fix this, we decided to fix the git history. But pushing to these repos requires
2 approvals on a PR. To open a PR, we had to create an empty commit. The resulting PR is: delphix/linux-kernel-aws#41
I manually started an update-package job to check if the history rewrite fixes the issue. It failed with:
http://ops.jenkins.delphix.com/job/linux-pkg/job/develop/job/update-package/job/linux-kernel-aws/9/console
This was because cherry-picking an empty commit requires the
--allow-empty
option.Solution
Add the
--allow-empty
option. To prevent such issues in the future, I started working on a changeto disallow rebase merges but I am still looking into if this is something that will work for us: https://github.com/delphix/github-infra/pull/615
Testing Done
TBA