Repository navigation
fix(list): let merge-tree probes finish when the picker cancels background work - #4274
Merged
Merged
Conversation
…round work Git writes an external merge driver's inputs as .merge_file_XXXXXX files in its cwd and removes them only on a normal return, so the SIGTERM the picker sends on exit stranded them in the worktree. Cmd::finish_once_started keeps the cancellation latch (nothing new spawns) but leaves a running command unsignalled; the merge-tree probe opts in. Closes #4273
1 task
1 task done
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.
Leaving the
wt switchpicker while agit merge-treeprobe is inside an external merge driver no longer strands.merge_file_*files in the worktree. Git writes the driver's three inputs as plain temp files in its cwd and removes them only when the driver returns normally, so the SIGTERM thatcancel_background_commands()sends on picker exit left them behind. SIGTERM is the right signal for the preview diffs (git cleansindex.lockon it), but not for this case.The change adds
Cmd::finish_once_started(). A command marked that way still honors the cancellation latch, so a cancelled probe that hasn't spawned never will. Once running, though, it isn't registered for signalling and runs to completion.compute_merge_tree_outcomeopts in. This is the first fix proposed in the issue.Verification:
merge_tree_cache_tests::merge_tree_probe_is_not_signalled_on_cancelruns a conflicting probe through a merge driver that records its parent PID, then checks that the runninggit merge-treeisn't a cancellation target. It fails without the fix and passes with it.wt switchfrom a PTY using the issue'ssleep 3; exit 1driver and pressed Esc after 1.5 s. The unfixed binary left three.merge_file_*files each run, and the fixed binary left none.Tradeoff: an abandoned probe now outlives
wtfor as long as the driver takes, and its result isn't cached because the in-process cache exits withwt. A Ctrl-C duringwt liststill reachesmerge-treevia the terminal's process-group broadcast, and that path is unchanged.Closes #4273 — automated triage