Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在数据库中有 git 补丁。如何将其转换为 diff 对象?在这里https://github.com/libgit2/rugged#diffs我可以从差异中获取补丁,diff.patch我想进行相反的操作。
diff.patch
我在数据库中有 git 补丁
您的意思是您存储了文本格式的差异吗?在这种情况下,您无法将其转换为 a git_diff,因为没有适用于 unidiff 的解析器。这不会有太大帮助,因为 libgit2 无法处理这样的对象。
git_diff
在某个时候可能会有一个,因为某些版本的 rebase 需要它,但现在我建议存储您区分哪些对象并从那里重新创建差异。