-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add custom patch command "Move patch into new commit before the original commit" #4552
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 custom patch command "Move patch into new commit before the original commit" #4552
Conversation
I almost broke this during the development of this branch, so add a test to guard against that. The point here is that the stack remains intact, i.e. the renamed commit is the head of the lower branch, and thus shows the "*".
…t of a stacked branch I almost broke this during the development of this branch, so add a test to guard against that. The point here is that the stack remains intact, i.e. the newly created commit is the last commit of the lower branch, and thus shows the "*".
This currently fails with an error.
…h merge commit BeginInteractiveRebaseForCommit is used for all the patch commands, and for rewording. It works by setting the commit we want to stop at to 'edit'; this doesn't work for merge commits. This wasn't a problem for the patch commands so far, because you typically don't use custom patches with merge commits (although we don't prevent this; maybe we should?). However, it was a problem when you tried to reword a merge commit; this previously failed with an error, as the test added in the previous commit demonstrated. Also, we want to add a new patch command that has to stop *before* the selected commit (pull patch to new commit before the original one), and this wouldn't work for the first commit in a feature branch, because it would have to set the last commit before that to 'edit', which isn't possible if that's a merge (which is likely). To fix all this, use a 'break' before the selected commit if the commit is a merge. It is important that we only do it in that case and not always, otherwise we would break the new regression tests that were added a few commits ago.
…nal commit" This is often useful to extract preparatory refactoring commits from a bigger one.
b4043cb
to
f6d1333
Compare
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesFootnotes
|
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.
LGTM, nice one
This is often useful to extract preparatory refactoring commits from a bigger one. It works best when selecting only entire hunks or even entire files; if partial hunks are in the patch, you are likely to get conflicts.
Along the way, fix rewording merge commits. (Not because I find this super important, but just because I came across the code while working on this.)
go generate ./...
)