-
Notifications
You must be signed in to change notification settings - Fork 37
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 warning about unmerged diffs and fix diff logic #1027
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1027 +/- ##
==========================================
- Coverage 75.41% 75.35% -0.07%
==========================================
Files 589 590 +1
Lines 42806 43119 +313
Branches 747 749 +2
==========================================
+ Hits 32284 32491 +207
- Misses 10444 10550 +106
Partials 78 78
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
diffs_b | ||
) | ||
} | ||
// JMT: This doesn't always return a good result so commenting it out |
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.
Near as I can tell this was just an optimization
// algorithm shifts left to include the leading newline. | ||
if (equality1[equality1.length - commonOffset] === '\n') { | ||
commonOffset -= 1 | ||
} |
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.
This is what was breaking the common diff use case of inserting a line. A diff of added code\n
became \nadded code
// because when it is inserted the first one is effectively eaten | ||
// by the replace and merging of the lines | ||
if (i === startLine && contentToInsert === '') { | ||
// However if the targetStartLine is the very top then we don't | ||
if (i === startLine && contentToInsert === '' && targetStartLine != 0) { | ||
contentToInsert += '\n' |
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 think I added this a while ago and while it's needed in some cases it doesn't work if inserting at the very top.
|
closes #1015