Add semi-linear support#39
Conversation
|
Thanks for working on it! I want to let you know that I've seen it but I won't have time to look at it until after FOSDEM. If I don't respond by Feb 7, please feel free to ping me! |
89db994 to
e25f92e
Compare
|
@nwalfield Thanks for the notice :) Meanwhile, I will run a bit more tests on it until get back on the PR. Enjoy FOSDEM! 👍 (I won't be there this year, but plan to check the videos.) |
9b8f09c to
f0e7200
Compare
|
Tests and semi-linear history example available here: https://github.com/smartin-vossloh/fast-forward/network |
|
Triggered from #39 (comment) by @smartin-vossloh. Trying to fast forward Target branch ( commit 6f66e12ccb351059900f82fcd87e8d9e9c095087 (HEAD -> main, origin/main, origin/HEAD)
Author: Angelo Gregorio Lovatto (GitHub) <12701614+0xangelo@users.noreply.github.com>
Date: Sat Jan 25 08:36:26 2025 -0300
docs: add Troubleshooting section to READMEPull request ( commit f0e72001d3bfd44568b228166bd9b610e066fdd9 (pull_request/sma/no-ff-merge)
Author: Samuel MARTIN <samuel.martin@vossloh.com>
Date: Fri Jan 17 09:30:56 2025 +0100
README.md: Clean-up double-spacesCan't fast forward * 6f66e12ccb351059900f82fcd87e8d9e9c095087 docs: add Troubleshooting section to README
| * f0e72001d3bfd44568b228166bd9b610e066fdd9 README.md: Clean-up double-spaces
| * 0fc327963c5707b6a16404abf8fe8b06e110fa61 README.md: Add a note about changing the merge trigger
| * 0ece24b2cd6c2f4aa1fdfc4c24074dd32ec0d535 README.md: Add section about the generated merge commit message
| * 22c8a7724a3ff7faecda4b07de2d14178bd20183 fast-forward: Add option for no-ff merge commit generation
| * 4b9fdf3c20522231156d8163c7c4f5f412867b43 README.md: Add section about semi-linear history
| * 9d4fb137d1244c67620efd38c4f2a528ea52bcf0 fast-forward: Add --no-ff merge support
|/
* 042cd23fbf9d5ed1400497a106c8abe4b45408ab ci: Increase debugging output.
commit 042cd23fbf9d5ed1400497a106c8abe4b45408ab
Author: Neal H. Walfield <neal@pep.foundation>
Date: Thu Aug 31 13:42:35 2023 +0200
ci: Increase debugging output.Rebase locally, and then force push to |
f0e7200 to
8339539
Compare
|
Up! 🙂 @nwalfield Do you know when you will be able to review this PR? |
|
@nwalfield Any news about this PR? when I could expect seeing it merged (or reworking it)? |
This change allows to choose the merge strategy to use for merging the pull-request. A merge-strategy parameter is added, allowing to choose the no-ff way (i.e. introducing a merge commit). The default strategy remains fast-forwarding the branch. Fixes sequoia-pgp#36
This change introduce a workflow setting (input) allowing to chose the kind of generated merge commit. This setting offers similar choices as those available under the GitHub *Allow merge commit* option. On pull-request events, the JSON keys set by the GitHub *Allow merge commit* are available through the GitHub API, but not on PR comment event. Hence, we have to set it in the workflow itself instead of relying on the repository settings from GitHub.
8339539 to
4d956d0
Compare
|
@nwalfield I'd really like to see this integrate and available in the fast-forward action. Hope you'll find sometime to review this PR. |
|
@nwalfield Any news about this PR? |
|
Hi @nwalfield 🙂 Do you have any news about this PR? I'm looking forward to get your feedback. |
|
@nwalfield up! 🙂 |
nwalfield
left a comment
There was a problem hiding this comment.
First, my apologies for the long time it took me to review these changes.
Most importantly, this change is missing a unit test. The unit tests are run from this action, which calls this script. It would be good to add a second script that checks that a valid semi-linear merge works, and that an invalid one (one that can't be fast forwarded) is rejected.
The option handling should be improved. An invalid value should always be rejected, and default should be an alias for the default value.
I appreciate that the two main changes are in separate commits. I'd prefer that the documentation related to a commit be added in the same commit.
Finally, the stylistic change is unrelated to this set of changes and should be proposed in a separate MR. That said, I'm not interested in that change. I prefer having two spaces after a full stop, and I don't want the churn.
| then | ||
| ${{ github.action_path }}/src/fast-forward.sh --merge | ||
| ${{ github.action_path }}/src/fast-forward.sh --merge \ | ||
| "${{ inputs.merge-method }}" |
There was a problem hiding this comment.
I'd prefer to have this be a named argument, e.g., --merge-stategy. This means fixing up fast-forward.sh to use getopts.
| ) | ||
| echo '```' | ||
| echo 0 >$EXIT_CODE | ||
| else |
There was a problem hiding this comment.
This should check that the strategy is really fast-forward. We should also add an else branch that errors out if the value of this option is not known.
| ](https://devblogs.microsoft.com/devops/pull-requests-with-rebase/#semi-linear-merge) | ||
| on your repository, i.e. merging a fast-forward branch with a merge | ||
| commit, add `.github/workflows/fast-forward.yml` to your repository | ||
| with the [following contents](.github/workflows/fast-forward.yml): |
There was a problem hiding this comment.
I don't think that the linked file matches the following contents.
I'm also not so excited about having an almost exact copy of the above section. I think that in the very least we should emphasize that the only difference between this workflow and the above workflow is changing to the merge-method variable, or remove the redundancy completely and just say change merge-method to xxx.
| indicating whether it is possible to fast forward the target | ||
| branch. | ||
| default: false | ||
| merge-method: |
There was a problem hiding this comment.
This doesn't match the commit message, which says that a merge-strategy parameter is added. Let's change this to merge-strategy.
| When merging using the merge-commit method, set the merge commit | ||
| message content. | ||
|
|
||
| Possible values are: default, pr-title or pr-title-and-body. |
There was a problem hiding this comment.
The description should describe what the three options do.
| MESSAGE=$(mktemp) | ||
| PR_NUMBER="$(github_pull_request .number)" | ||
| PR_HTML_URL="$(github_pull_request .html_url)" | ||
| # debug stuff |
There was a problem hiding this comment.
What does this comment mean?
| echo "* ${PR_HTML_URL}" | ||
| echo "* from ${PR_REF} into ${BASE_REF}" | ||
| ;; | ||
| *) |
There was a problem hiding this comment.
This isn't great. This should be an explicitly named option or default. If the value doesn't match any of the known values, we should emit an error.
|
|
||
| This repository contains a GitHub action that merges a pull request by | ||
| fast forwarding the target branch. The action is triggered when an | ||
| fast forwarding the target branch. The action is triggered when an |
There was a problem hiding this comment.
I'm a bit confused about this and other similar changes. It seems that this is doing the opposite of what the commit message says: instead of fixing the double spaces after full stops, it is removing them!
|
Hi @nwalfield , First, apologies for the delay. I hope I will be able to rework following your review in the coming weeks. Thanks for your patience. |
|
No worries. |
This short series adds support for semi-linear merge strategy.
To do so, the PR must be fast-forward and a merge-commit must be created for the merge.
The fast-forward action is leveraged to run the check when merging, and enhanced by adding
the
--no-ffoption to thegit mergecommand when configured so.Closes #36