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
//! Reads of a **project** repo — the balls invocation path's own git repo,
//! not a lernie workspace's `repo.git` (DESIGN §5.1 #32, VISION §4.10).
//!
//! Every other module here reads the workspace repo; this one reads the repo
//! the agent's work lands in. It lives beside them anyway because [`cmd`] is
//! the crate's one `git` doorway (its `base_cmd` is what scrubs the inherited
//! `GIT_DIR`/`GIT_INDEX_FILE`, §16), and a second fork site would be a second
//! place for that scrub to be forgotten.
//!
//! Four reads, all pure: name the integration branch, resolve a ref to a
//! commit, count the churn between two commits, and read one file's patch.
//! Nothing here writes, and nothing here spends a balls or lernie verb — the
//! project diff is a pure git read (VISION §4.10 item 4).
use GitTreeError;
use ;
use Path;
/// The branch this repo's `HEAD` points at — balls' own integration-branch
/// derivation (`git symbolic-ref --short HEAD`), spelled the way balls spells
/// it so yog and `bl close` can never name two different targets.
///
/// `None` covers both ways there is no answer: the path is not a readable git
/// repo, and a detached `HEAD` that names no branch at all. Both are "this
/// project can state no target", which is one fact for the caller to report,
/// not two.
pub
/// The commit `spec` resolves to, or `None` when this repo does not have it —
/// a work branch never minted, a target branch that is gone. Absence is the
/// answer, never an error: a ref that is not there is a fact about the repo.
pub
/// `git diff --numstat <range>` — one `<added>\t<removed>\t<path>` row per
/// changed file, with `-` for both counts of a binary file. Counts, not bytes:
/// the listing of what an attempt changed must not cost the whole patch.
pub
/// `git diff <range> -- <path>` — one file's patch text, read only when the
/// operator asks for that file.
pub