6

I am currently working on a flashcard application where decks created by the user act as Git repositories. When a card is created in the app, a new file is committed to the repository, when a card is changed, the file is changed, and when a card is deleted--well, you get the point.

The file format that the application saves to is a gzipped Git repository, so at no point will I ever need to write the repository to disk. How can I best handle treating decks as a Git repository in this way?

4

1 回答 1

9

看看 libgit2。它支持内存中的 git 存储库方案,并且还绑定到多种语言:

https://libgit2.github.com

例如,通过使用可靠的libgit2的 ruby​​ 绑定,您可以执行以下操作:

a_backend = Rugged::InMemory::Backend.new(opt1: 'setting', opt2: 'setting')

repo = Rugged::Repository.init_at('repo_name', :bare, backend: a_backend)
于 2016-10-05T01:41:44.413 回答