Skip to content
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

问题:插件的文件diff模式和gitlab diff文件对比出来的结果不一致,是mode不一样吗,有办法调整一致吗 #208

Open
CocoaTouch123 opened this issue Jul 28, 2023 · 6 comments
Labels

Comments

@CocoaTouch123
Copy link

@otakustay 你好,请帮忙看下,我们本地使用react-diff-view插件后,同样的源文件和新文件比对出来的结果和gitlab的比对的结果有差异,如下图:
插件的:
Xnip2023-07-28_10-20-14

gitlab的截图:
Xnip2023-07-28_10-26-48
如上面gitlab的截图,代码提交的时候也是,左边删除112,113,114行右边新增109,110行
左边删除118,119行,右边新增114,115,116行

但是插件diff的时候错行diff了,请问下有办法或者参数修改插件的对比精度

@CocoaTouch123
Copy link
Author

看了下源码,好像是unidiff 下的diffLines函数计算的结果导致的

@HQ1363
Copy link

HQ1363 commented Aug 1, 2023

@otakustay 我也遇到了一样的问题,求帮忙一起看看,感激不尽

@HQ1363
Copy link

HQ1363 commented Aug 1, 2023

将gitlab的diff传递给组件,此问题得到解决。不过直接用jsdiff的diffLines算出来的结果确实和gitlab不一致,虽然也是正确的。

@stale
Copy link

stale bot commented Sep 16, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 16, 2023
@otakustay
Copy link
Owner

如果能够提供一段样本的新旧代码,以及git diff计算结果,我可以尝试看一下unidiff生成的是啥样。当然git diff本身有很多特殊逻辑在里面,并不是unidiff可以完全模拟了,这也是预期情况

@stale stale bot removed the stale label Nov 13, 2023
Copy link

stale bot commented Dec 15, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants