-
Notifications
You must be signed in to change notification settings - Fork 78
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 @triagebot squash
command
#821
Comments
This first made me annoyed enough to open an issue in rust-lang/rust#76289, but it's happened a lot before that too. |
This comment has been minimized.
This comment has been minimized.
@jyn514 Hmm, are you sure this command is correct? Running (for example) $ git checkout https://github.com/rust-lang/rust/pull/77508
error: pathspec 'https://github.com/rust-lang/rust/pull/77508' did not match any file(s) known to git fails for me. Also:
|
Sure, all of those seem fine. I never actually tested these commands. |
You need to install hub (GitHub integration for git) if you want the command to work without fetching. |
Or you can use the newly-stable |
What about https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/about-merge-methods-on-github#squashing-your-merge-commits ? (GitHub allows to squash commits while merging) |
We need to merge PRs through @bors, we can't use the merge button on rust-lang/rust. |
I implemented this in @bors (rust-lang/homu#122) because it already has a local git clone and is performing the merge. Is this still wanted in triagebot ? |
I think the homu support is great but I am a bit wary of r+'ing PRs that are then going to get squashed by homu at a later point. But generally I think support in homu is probably enough, so I'm going to close this. We can reopen if there's problems with the homu support at some point. |
I'll start taking a look at this. I'm curious if the required "allow edits from maintainer" option is enabled by default in GitHub's UI. It is for me, but that might be because that setting is saved between PRs. |
I believe we can make an assumption that it is enabled for the purposes of this feature; if it's not, we will error (ideally in a nice way, perhaps providing instructions on what to do: e.g., the author pushing a given commit hash to their branch). In terms of making this happen:
You will want to create a new parser for this and wire up a new handler; hopefully easy to find to bits with those two pointers to wire this up. In terms of handling the command, I think my expectation is that we will use the git database API to create a new commit -- this will probably mean adding to github.rs to support the API, with:
Once we create the commit, I think we'd use the update a reference API to force push their branch into the right commit, and leave a comment with what we did. If any of that fails, as I suggested above, I would post a comment saying that we couldn't squash because of X but still generated the commit sha X which they can make use of by running something like Hopefully that all helps! Please do let me know if there are any questions, and also feel free to say some of this is wrong. This is just a sketch of a design literally half-invented right now. |
Sounds good. Thank you for the detailed outline. |
A common challenge new contributors have is squashing commits into one:
git rebase
, including that you should use-i
to edit individual commitsgit push -f
is ok (this last step trips a lot of people up - they'll rebase and then 'merge branch into master' which defeats the whole point)Even for existing contributors squashing is annoying because it messes up your build cache, since
cargo
works on mtimes and not hashes.It would be great to have a
squash
command that automatically squashes all commits in the current PR into one. The way to do this locally isNNNNN is the pr number, CONTRIBUTOR is the author, BRANCH is the branch name; all of these are easily available from the PR itself.
The text was updated successfully, but these errors were encountered: