forge
Clone
https://git.tahinli.com/Tahinli/forge.git
0 watching0 forksRustAGPL-3.07.1 MiB490f099Tahinli7 hours ago322 commits
| 1 | //! Lines changed per commit, for the history strip on the repo page and the CI page: the newest |
| 2 | //! commits reachable from a commit, each counted against its first parent. One `git log` run with |
| 3 | //! `--shortstat`, so the output is a few bytes per commit however big the commits are. |
| 4 | |
| 5 | use Path; |
| 6 | use Duration; |
| 7 | |
| 8 | use crateGitEnv; |
| 9 | use crate; |
| 10 | use crate; |
| 11 | |
| 12 | /// Most commits one call returns. |
| 13 | pub const MAX_COMMITS: usize = 48; |
| 14 | /// Longest a single walk may take. A huge commit is one diff for git to count, so this bounds the |
| 15 | /// page's wait; the child is killed when the timeout drops the read. |
| 16 | const WALK_TIMEOUT: Duration = from_secs; |
| 17 | /// Record start in the `log` format, so a commit's header can be told from its stat line. |
| 18 | const REC: u8 = 0x1e; |
| 19 | |
| 20 | /// One commit and the lines it changed: additions plus deletions against its first parent. |
| 21 | /// A root commit counts against the empty tree. Binary files add nothing to the count. |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | /// The newest `limit` commits reachable from `head` (a full object id), newest first, capped at |
| 29 | /// [`MAX_COMMITS`]. Merge commits count their diff against the first parent only. |
| 30 | pub async |
| 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 | /// Splits `log` output into records. Each record is one commit id, then its stat line when the |
| 58 | /// commit changed anything. |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | /// The insertions plus deletions in one `--shortstat` line, such as |
| 76 | /// " 3 files changed, 10 insertions(+), 2 deletions(-)". Zero for any other line. |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 |