Skip to content

Commit 79c5941

Browse files
committed
Sketch of the APIs involved in branch::apply().
1 parent 4931625 commit 79c5941

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

crates/but-workspace/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![deny(missing_docs, rust_2018_idioms)]
1+
#![deny(missing_docs)]
22
#![deny(clippy::indexing_slicing)]
33

44
//! ### Terminology
@@ -55,6 +55,8 @@ pub use head::{head, merge_worktree_with_workspace};
5555
/// Ignore the name of this module; it's just a place to put code by now.
5656
pub mod branch;
5757

58+
pub mod snapshot;
59+
5860
mod changeset;
5961

6062
mod commit;

crates/but-workspace/src/snapshot.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//! The ability to create a Git representation of diverse 'state' that can be restored at a later time.
2+
3+
///
4+
pub mod create_tree {
5+
6+
/// A way to determine what should be included in the snapshot when calling [create_tree()]()
7+
pub struct StateSelect {}
8+
9+
/// Contains all state that the snapshot contains.
10+
#[derive(Debug, Copy, Clone)]
11+
pub struct Outcome {
12+
/// The combined tree with all snapshot information.
13+
pub tree: gix::ObjectId,
14+
}
15+
16+
pub(super) mod function {
17+
/// Create a tree that represents the snapshot for the given `state`, with the basis for everything
18+
/// being the `head_tree_id` (i.e. the tree to which `HEAD` is ultimately pointing to).
19+
///
20+
/// Note that objects will be written into the repository behind `head_tree_id` unless it's configured
21+
/// to keep everything in memory.
22+
pub fn create_tree(head_tree_id: gix::Id<'_>) -> ! {
23+
todo!()
24+
}
25+
}
26+
}
27+
pub use create_tree::function::create_tree;

0 commit comments

Comments
 (0)