Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(hooks): use same branchless dir for all worktrees #1095

Merged
merged 7 commits into from
Oct 22, 2023
Merged

Conversation

arxanas
Copy link
Owner

@arxanas arxanas commented Oct 10, 2023

Closes #928.

@arxanas arxanas force-pushed the arxanas/worktree branch 2 times, most recently from 3381acc to 9e0f970 Compare October 15, 2023 23:51
@arxanas arxanas marked this pull request as ready for review October 15, 2023 23:52
@arxanas arxanas force-pushed the arxanas/worktree branch 2 times, most recently from 90f2178 to 4c039c5 Compare October 19, 2023 05:26
To silence the warnings about using resolver v1 by default.
If tracing is installed, the `warn!` call will attempt to write to `ErrorStream`, which seems to cause a deadlock when we are destroying the `ErrorStream`.
Previously, all worktrees would have their own event log, which means that they wouldn't agree on the set of visible commits. They would also have to recalculate the same DAG, etc. After this commit, they all share the same event log, etc.

This creates a temporary regression in the Phabricator forge for `git submit`, fixed in the next commit. The problem is that the rewrite events in the test run invoking `arc` shouldn't be propagated to the parent event log.
@arxanas arxanas force-pushed the arxanas/worktree branch 2 times, most recently from 7251b72 to 7a7c61c Compare October 22, 2023 00:18
`arc diff` will amend the current commit as part of the submit process (primarily to create the change ID/embed the review URL in the commit message), but we don't want those changes to be available in the regular event log. My solution is to create a special event transaction ID that indicates that events should not be added to the event log.

Another solution could be to allow events to created in a transaction, and then roll back the transaction rather than commit it. (Currently, "transactions" only refer to groups of events, and are always committed.) Normally, SQLite (which we use for the event log) would expose this kind of transactional functionality, but we can't use database-level transactions because the events span multiple process calls (such as Git hooks that are invoked as child processes), so we can't use the normal database mechanisms for this. It would be a lot of work to implement our own transaction system, so it just seems simpler to suppress all events immediately.

One consequence is that users who create or rewrite commits inside `git test` calls will not have the events be preserved, which hopefully does not happen often in practice. Note that `git test fix` would still look at the resulting commits and apply the tree-level fixes, even though the original rewrite events in the worktrees wouldn't be preserved.
@arxanas arxanas merged commit beb060f into master Oct 22, 2023
13 checks passed
@arxanas arxanas deleted the arxanas/worktree branch October 22, 2023 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants