I need to commit the current state of the workdir (i.e. the files and their content as stored on the filesystem) into a non-checked out branch. It is important that this is done in a stateless way because the user may have local modifications or may have staged some files. That means that the files should not be staged through the index before being committed. (The rest of the application already operates in a stateless way.)
One straightforward way to achieve this would be to build that Tree
recursively while descending the directory. But I assume that such a common task is very likely already implemented in Rugged/libgit2 (for example, Index#add_all
does something very similar).
Does Rugged provide a way to create a Tree
object from the current workdir (respecting .gitignore
& Co.) without changing the index?