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

每次项目启动时,notes下所有md文档git都检测有变化 #124

Closed
wuwubin opened this issue Jul 19, 2024 · 2 comments
Closed

每次项目启动时,notes下所有md文档git都检测有变化 #124

wuwubin opened this issue Jul 19, 2024 · 2 comments
Assignees

Comments

@wuwubin
Copy link

wuwubin commented Jul 19, 2024

没有对文档进行任何操作,运行项目后所有文档git都检测到有变化,导致多人同步编写时经常有文档冲突并丢失。

@wuwubin
Copy link
Author

wuwubin commented Jul 19, 2024

初步猜测为运行编码时,对文档有读写操作,导致文档编码变化,使git检测到文档变化

@pengzhanbo
Copy link
Owner

pengzhanbo commented Jul 19, 2024

该问题我也有注意到。

主题确实有对文档内容进行读写的操作,当前的逻辑对文件都进行了一次重写操作,可能是在这一步导致了问题。由于不同系统之间的 eol 符存在差异,从本地提交到 git 服务器 后,重新拉取或他人拉取新提交到本地,在重启 主题进行写入时,都可能会导致 eol 符被替换。git 检测到有修改,当在差异对比中又看不到正确的信息。

一方面,可以给项目添加一个 .gitattributes 文件,添加以下内容:

* text eol=lf
*.txt text eol=crlf

另一方面,最近我着手于优化主题在本地服务中的开发体验,也在尽量的减少不必要的 I/O 操作,因此,我也会在下个版本中,对 主题启动时对所有文档的读写进行优化,尽量避免不必要的读写,这也可以有效避免非正常的文件变化

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants