CommitBuilder(CommitBuilder prior) throws Exception { branch = prior.branch; DirCacheBuilder b = tree.builder(); for (int i = 0; i < prior.tree.getEntryCount(); i++) b.add(prior.tree.getEntry(i)); b.finish(); parents.add(prior.create()); }
/** * Forcefully update this branch to a particular commit. * * @param to the commit to update to. * @return {@code to}. * @throws Exception */ public RevCommit update(CommitBuilder to) throws Exception { return update(to.create()); }
/** * Update a reference to point to an object. * * @param ref the name of the reference to update to. If {@code ref} does not start with {@code * refs/} and is not the magic names {@code HEAD} {@code FETCH_HEAD} or {@code MERGE_HEAD}, * then {@code refs/heads/} will be prefixed in front of the given name, thereby assuming it * is a branch. * @param to the target object. * @return the target object. * @throws Exception */ public RevCommit update(String ref, CommitBuilder to) throws Exception { return update(ref, to.create()); }