There is a bare repository, I have a commit id, and want to read all the files at that commit without cloning.
This repository.Lookup<Tree>(repository.Commits.First().Tree.Sha)
code give me only the files that are in the commit but I want also other files that exists at that level.
How to do that?
My understanding of your question is that you're willing to access the whole content of a commit, not only the first level of the commit. The code below will work against a bare (or a standard) repository and will allow one to recursively access and examine the content of a commit.
In order to make it easier for you to test drive it, it dumps information (git object meta data along with blob content) in the console output.
Would you precisely know the path of a specific file you'd like to access, use the indexer exposed by the
Commit
type in order to directly access theGitObject
you're after.For instance: