Skip to main content

Module auto_push_dirty_paths

Module auto_push_dirty_paths 

Source
Expand description

The paths of a dirty worktree and of a fast-forward, and their overlap. What: The paths a dirty worktree has uncommitted work in, the paths a fast-forward would change, and the overlap between them. Why: After an auto-push publishes a merge, local main can follow it even in a worktree that holds uncommitted work, provided the move changes none of the files that work touches. Another session’s staged renames then never keep this branch behind the remote.

In TS you’d write (pseudocode):

// overlappingPaths(statusPaths(statusZ), diffPaths(diffZ))

Functions§

diff_paths
What: The paths of git diff --name-only -z. Why: They are the files a fast-forward from one commit to the other writes.
listed
What: The overlapping paths as text for the report: the first few by name, then a count. Why: The person must see which files held the branch back, and a report is not a place for a hundred names.
overlapping_paths
What: The dirty paths a move would also change, without repeats. Why: Exactly these paths decide whether the move may run.
status_paths
What: The paths named by git status --porcelain=v1 -z: each entry’s path, and the original path of a rename or copy. &[u8] borrows Git’s output; Vec<Vec<u8>> is an owned list of byte paths. Why: A staged rename touches both its names, and a move that changes either one would overwrite the work.