pub fn changed_paths(
context: &GitContext,
root: &Path,
) -> Result<ChangedPaths, String>Expand description
What:
The paths git status lists as changed or untracked in the worktree at root, counted, with the first, and whether a
.gitattributes file is among them (also one inside an untracked directory); or the words that say which Git run failed
and how.
Why:
Only Git’s own status tells a real change from a stale record of file times. The read takes no optional lock, so it never
disturbs the checkout a person works in. A listing with nothing in it is an answer (every file equals its commit by content),
never a failure: the stat data of an index that was just written, or of a file that was touched, proves nothing, and Git
settles those by content.
In TS you’d write (pseudocode):
const changed = await changedPaths(context, root); // throws the reason Git could not say