Class TreeCreator


  • public class TreeCreator
    extends Object
    A creator for a new Git tree. To create the new tree, the tree of another commit is taken as a basis and modified.
    • Constructor Detail

      • TreeCreator

        public TreeCreator​(org.eclipse.jgit.revwalk.RevCommit baseCommit)
    • Method Detail

      • addTreeModifications

        public void addTreeModifications​(List<TreeModification> treeModifications)
        Apply modifications to the tree which is taken as a basis. If this method is called multiple times, the modifications are applied subsequently in exactly the order they were provided.
        Parameters:
        treeModifications - modifications which should be applied to the base tree
      • createNewTreeAndGetId

        public org.eclipse.jgit.lib.ObjectId createNewTreeAndGetId​(org.eclipse.jgit.lib.Repository repository)
                                                            throws IOException
        Creates the new tree. When this method is called, the specified base tree is read from the repository, the specified modifications are applied, and the resulting tree is written to the object store of the repository.
        Parameters:
        repository - the affected Git repository
        Returns:
        the ObjectId of the created tree
        Throws:
        IOException - if problems arise when accessing the repository