I'm creating a tool that will allow people to store "solutions" to tests. Since I don't want to reinvent version control, I decided to use git's tree/blob/object stuff -- my idea is to create a git tree object out of the current working directory.

The problem is that I want this tool to not touch the state of the user's repository, except to look up hashes to existing objects of course.

I've looked at both mktree and write-tree, and the former needs ls-tree output and the latter needs to examine the index. Neither of these are what I want.

I'm happy to dive deeper and write the analogs of these commands for the working tree, however I'm having trouble figuring out any lower-level git tools to manipulate trees, blobs, and objects.

Ideally, the user will be able to run:

$ git create-tree .

and git will spit out the hash of the newly created tree object.

Edit
Report