File tree Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change 3
3
///
4
4
pub mod create_tree {
5
5
use bstr:: BString ;
6
+ use but_graph:: VirtualBranchesTomlMetadata ;
6
7
7
8
/// A way to determine what should be included in the snapshot when calling [create_tree()](function::create_tree).
8
- pub struct State < ' a > {
9
+ pub struct State {
9
10
/// The result of a previous worktree changes call.
10
11
///
11
12
/// It contains detailed information about the complete set of possible changes to become part of the worktree.
12
- pub changes : & ' a but_core:: WorktreeChanges ,
13
+ pub changes : but_core:: WorktreeChanges ,
13
14
/// Repository-relative and slash-separated paths that match any change in the [`changes`](State::changes) field.
14
15
/// **It's an error if there is no match.** as there is not supposed to be a snapshot without a change to the working tree.
15
16
pub selection : Vec < BString > ,
@@ -40,6 +41,14 @@ pub mod create_tree {
40
41
pub metadata : Option < gix:: ObjectId > ,
41
42
}
42
43
44
+ /// A utility to more easily use *no* workspace or metadata.
45
+ pub fn no_workspace_and_meta ( ) -> Option < (
46
+ & ' static but_graph:: projection:: Workspace < ' static > ,
47
+ & ' static VirtualBranchesTomlMetadata ,
48
+ ) > {
49
+ None
50
+ }
51
+
43
52
pub ( super ) mod function {
44
53
use super :: { Outcome , State } ;
45
54
use but_core:: RefMetadata ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ mod branch_details;
5
5
mod commit_engine;
6
6
mod flatten_diff_specs;
7
7
mod ref_info;
8
+ mod snapshot;
8
9
mod tree_manipulation;
9
10
mod ui;
10
11
Original file line number Diff line number Diff line change
1
+ mod create_tree {
2
+ use crate :: utils:: read_only_in_memory_scenario;
3
+ use but_graph:: VirtualBranchesTomlMetadata ;
4
+ use but_workspace:: snapshot;
5
+
6
+ #[ test]
7
+ fn worktree_all_filetypes ( ) -> anyhow:: Result < ( ) > {
8
+ let repo = read_only_in_memory_scenario ( "all-file-types-changed" ) ?;
9
+ let ( head_tree_id, state, no_workspace_and_meta) = args_for_worktree_changes ( & repo) ?;
10
+ snapshot:: create_tree ( head_tree_id, state, no_workspace_and_meta) ?;
11
+ Ok ( ( ) )
12
+ }
13
+
14
+ fn args_for_worktree_changes (
15
+ repo : & gix:: Repository ,
16
+ ) -> anyhow:: Result < (
17
+ gix:: Id < ' _ > ,
18
+ snapshot:: create_tree:: State ,
19
+ Option < (
20
+ & ' static but_graph:: projection:: Workspace < ' static > ,
21
+ & ' static VirtualBranchesTomlMetadata ,
22
+ ) > ,
23
+ ) > {
24
+ todo ! ( )
25
+ }
26
+ }
You can’t perform that action at this time.
0 commit comments