I have a working checkout function based on dulwich:
def checkout(repo, ref=None):
if ref is None:
ref = repo.head()
index = repo.index_path()
tree_id = repo[ref].tree
build_index_from_tree(repo.path, index, repo.object_store, tree_id)
return [repo.object_store.iter_tree_contents(tree_id)]
But how would I amend that to checkout an individual file or directory?
Is there something that could replace the build_index_from_tree
line?