c# - Host repository and save content in a database -


is possible self host git repository libgit2sharp , save content of repository (remote) in database? needed, because want access sources synchronized between windows directory , database in application retrieving data database.

edit

the repository contains scripts, such ironpython, sql , xaml. text files stored in repository (database).

later access scripts like: scriptmanager.getscript('/scripts/test.py'). getscript method return script-content database. (only simple example).

edit

enter image description here

libgit2sharp should hosting component. some client should read scripts directly database, without git.

solution

enter image description here

i think solution more straight forward, becuase self hosting on libgit2sharp not possible , not best way. problem more on in complete idea / architecture. think current solution best.

thank you!

later access scripts like: scriptmanager.getscript('/scripts/test.py')

well, if need access content of file latest commit (ie. tip) of branch pointed @ head, following piece of code should trick:

using (var repo = new repository("path/to/your/local/repo") {    var blob = repo.head.tip["/scripts/test.py"].target blob;    var content = blob.getcontenttext(); } 

update

if correctly understand "save content of repository (remote) in database", you'd export content of repository in database. repository "master" , sybase read-only replica of it.

one thing cannot achieved @ moment: hosting git repository server side libgit2sharp , make endpoint git client interacts with. there's opened feature request (see #90).

however, nothing prevents host repository git-daemon or packaged tool (eg. bonobo git server) , use libgit2sharp ease exporting task.

the code above shows how extract known file libgit2sharp.

in order blindly export whole content of commit/tree, see so answer.


Comments