Repository navigation
fix(hooks): announce background hooks per directory - #4781
Merged
Merged
Conversation
`wt merge --no-remove` registers post-commit (in the feature worktree, no display path) and post-merge (in the target, with a display path) on one announcer. The flush took the first display path it found and put it on a single combined line, so the output read `Running post-commit: mark (user); post-merge: sync (user) @ ~/repo`, implying post-commit ran in the target. Group pipelines by display path and print one `Running` line per group. Pipelines sharing a path (post-remove, post-switch, post-merge after a removal) still combine onto one line.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
wt merge --no-removewith both apost-commitand apost-mergehook printed one combined line,Running post-commit: mark (user); post-merge: sync (user) @ ~/repo. That reads as ifpost-commitran in the target, but it runs in the feature worktree. This PR gives hooks that run in different directories separateRunninglines:run_hooks_backgroundputs the display path of the first pipeline that has one at the end of the line, on the assumption (written in its docstring) that every hook in a batch shares a path. That stopped being true forpost-commitonce thepost-commitpipeline started being dropped when its worktree is removed. Nowpost-commitreaches the flush only when the feature worktree is kept, which is exactly when its directory differs frompost-merge's. Hooks that share a path, such aspost-remove,post-switchandpost-mergeafter a removal, still combine onto one line, so existing snapshots are unchanged.The new snapshot test
test_merge_announces_post_commit_and_post_merge_by_directoryproduced the misleading single line before this change. The module spec inhook_announcement.rsis updated to match. Its four-typewt mergeexample, which includedpost-commitalongsidepost-remove, described output that can no longer happen.Found by the nightly code survey of
src/commands/hooks.rs.