Skip to main content

Module scope

Module scope 

Source
Expand description

Which lines of which files to analyse (--since, --lines).

Structs§

Hunk
One hunk of git diff -U0: where the new lines are, and the lines that were there.
Scope
Line ranges per file. Paths are relative to the workspace root, with / separators.

Functions§

hunks
The hunks of the files that are still there. The lines of a hunk are counted as its header says, so a removed line that starts with -- is not taken for a file header.
line_count
Number of lines in source (0 for an empty file).
line_of
1-based line of the byte at offset.
matches_any_glob
Returns true if path matches any glob pattern in patterns.
matches_glob
Matches a package-relative path against a simple glob pattern supporting * (any chars except /), ? (one char except /), and ** (zero or more path segments/chars). Runs in O(pattern.len() * path.len()) time and O(path.len()) memory.
parse_line_spec
Parses one --lines specification: FILE, FILE:LINE, or FILE:FROM-TO (1-based, inclusive).
range_of
Where the new lines of a hunk are in text, as a byte range: empty, at the place the old lines were, when the hunk has no new lines.
undo
text with the hunks undone: the old lines where the new ones are. The hunks are of this text and do not overlap. None when one of them does not fit the text.