Skip to content

Commit 838760a

Browse files
authored
Merge pull request #726 from ijackson/treebuild-docs
Improve docs and xrefs re tree building
2 parents d98c8f1 + 16cb29b commit 838760a

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/build.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,15 @@ pub struct RepoBuilder<'cb> {
6464
pub type RemoteCreate<'cb> =
6565
dyn for<'a> FnMut(&'a Repository, &str, &str) -> Result<Remote<'a>, Error> + 'cb;
6666

67-
/// A builder struct for git tree updates, for use with `git_tree_create_updated`.
67+
/// A builder struct for git tree updates.
68+
///
69+
/// Paths passed to `remove` and `upsert` can be multi-component paths, i.e. they
70+
/// may contain slashes.
71+
///
72+
/// This is a higher-level tree update facility. There is also [`TreeBuilder`]
73+
/// which is lower-level (and operates only on one level of the tree at a time).
74+
///
75+
/// [`TreeBuilder`]: crate::TreeBuilder
6876
pub struct TreeUpdateBuilder {
6977
updates: Vec<raw::git_tree_update>,
7078
paths: Vec<CString>,

src/treebuilder.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ use libc::{c_int, c_void};
66
use crate::util::{Binding, IntoCString};
77
use crate::{panic, raw, tree, Error, Oid, Repository, TreeEntry};
88

9-
/// Constructor for in-memory trees
9+
/// Constructor for in-memory trees (low-level)
10+
///
11+
/// You probably want to use [`build::TreeUpdateBuilder`] instead.
12+
///
13+
/// This is the more raw of the two tree update facilities. It
14+
/// handles only one level of a nested tree structure at a time. Each
15+
/// path passed to `insert` etc. must be a single component.
16+
///
17+
/// [`build::TreeUpdateBuilder`]: crate::build::TreeUpdateBuilder
1018
pub struct TreeBuilder<'repo> {
1119
raw: *mut raw::git_treebuilder,
1220
_marker: marker::PhantomData<&'repo Repository>,

0 commit comments

Comments
 (0)