Reputation: 1538
I want a function that accepts two strings and generates a diff patch string, a la git diff foo
.
I am working on a wiki-style system with history. To implement history, I thought it would be effective to store document patch contents only, rather than full copies of each version of the document. Replaying patches seems like a nice way to reproduce any version of the document. git
already does this well. I want to use git's version control ability without creating a git index for every document, and instead using my database as a lesser capable version store.
I'm planning on using https://docs.rs/git2/latest/git2/index.html, but cannot figure out yet:
Any advice would be great! I'm tagging with libcgit2 as well, because despite using rust, I'm confident I could port C examples to the rust bindings.
Upvotes: 0
Views: 336
Reputation: 184
If your data is not stored as a git repository, libgit2 is not the best tool to help you. But it is a good library if you do want to store as a git repo.
If you want to diff two texts in Rust, you're probably better off using something like https://crates.io/crates/diff or https://crates.io/crates/slice-diff-patch.
Upvotes: 0