-
Notifications
You must be signed in to change notification settings - Fork 76
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
Fix PR merging algorithm #26
Conversation
The problem is that - The new_body doesn't know the current status. - Diff & merge algorithms can't treat checking status well. So my solution is: 1. scan every pr check status in old_body. 2. Update it to unchecked. 3. Then diff and merge as always. 4. Update check status by results of 1. Close: x-motemen#20
A = <<ERB
- [x] #1001 aaaaaaaaaa
- [x] #1002 cccccccccc
ERB
B = <<ERB
- [ ] #1000 bbbbbbbbbb
- [ ] #1001 aaaaaaaaaa
- [ ] #1002 cccccccccc
ERB
print merge_pr_body A, B Before
After
|
I think that this solution can be acceptable. Current problem is that checkbox list items are often lost after after merge. (#20, #21) Pros:
Cons:
This is a trivial problem compared to losing items. What do you think? @motemen |
I think this problem is the limit of "2-way merge" algorithm.
Apply diff between 1 and 2 into 3. This makes the result correctly. And the cons of this case is that pull-request templete is not renewed by new pull-request template if the pull-request templete has changed between the commits. Because it will be treated as diff of 1 and 2, it will be reverted. |
Overall looks good. Can you pull origin/matter and add some tests? |
Okay, I will add some tests basing on #25 |
@motemen I added tests. Can you review this? |
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.
🙆♀️
Thanks! |
The problem is that
So my solution is:
Close: #20