[solved] In memory Git2 Index modification

Hello everyone,

I am very new to Rust (just started this week) and as an exercise I chose to build a simple HTTP REST API around git2.

As a basis I used this article https://kennyballou.com/blog/2016/01/git-in-reverse
Here the author makes use of git hash-object -w --stdin to write blobs to the index without needing an actual working directory.
I reflected the methods used in here https://github.com/khusseini/xersize-rust-git2/blob/master/src/stupiddb/mod.rs#L13

Creating and opening a repository works and adding a blob works too, however when I add a second blob, the resulting tree contains only the new blob and old ones are not "copied".
Creating adding and writing the blob happens here: https://github.com/khusseini/xersize-rust-git2/blob/master/src/rest/data.rs#L12

I am not sure where my logical mistake is, as I am not only new to Rust but also never used any libgit2 libraries before.

Maybe someone could shed some light on this? Also any comments on my coding style, would be nice, to know if I am doing things the Rust way.

UPDATE: I am not sure how and why, but the experiment works now. I'm able to throw JSON at my REST API and have it stored in git.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.