1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// SPDX-License-Identifier: Apache-2.0
//! The read-only view of a project tree.
//!
//! Every phase of a run except delivery reads the project through
//! [`ReadTree`]. Two implementations exist:
//!
//! - [`crate::fs::WorkingDir`] reads the live working directory through a
//! `cap-std` capability. It may change concurrently with the run; Bearout
//! makes no snapshot of it.
//! - [`crate::git::GitTree`] reads a frozen Git tree: the index as captured
//! at the start of the run, or one resolved revision. Its paths, modes, and
//! object identities cannot change during the run, whatever happens to the
//! working directory, the index, or the branch afterwards.
//!
//! The interface deliberately carries no write or delete operation. Writes
//! go through the separate delivery capability in [`crate::fs`], which only
//! the working directory provides.
//!
//! Semantics shared by every implementation:
//!
//! - paths are [`ProjectPath`]s relative to the tree's root;
//! - `read`, `read_text`, `file_len`, `is_file`, `is_dir`, and `exists`
//! follow symbolic links, but only inside the tree; a link that leaves it
//! is an error, never a read of something outside;
//! - `walk` never follows or reports symbolic links, refuses a directory
//! that is or lies beneath a symbolic link, never descends into a
//! submodule, and fails on a name that is not a portable project path;
//! - `symlink_component` inspects the path literally, without following.
use io;
use Arc;
use crateProjectPath;
/// Read-only access to one project tree.