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

poetry-tracking-mode seems to revert worktree version of a file when doing magit-diff-visit-file, losing unstaged changes #57

Open
bramadams opened this issue Sep 5, 2024 · 0 comments · May be fixed by #58

Comments

@bramadams
Copy link
Contributor

I've been using poetry.el for a while, and it works perfectly.

However, recently I started exploring magit's magit-diff-visit-file, which is bound to RET in a magit diff view such as shown in the status buffer. When on a removed line, it jumps back to the previous blob containing that line, which is handy.

However, when poetry-tracking-mode is active, the command also seems to revert the worktree file to that old blob, discarding any unstaged/uncommitted changes to that file. This happened a couple of times (latest magit and poetry.el), and there is no way to recover the unstaged changes in the reverted worktree file, except for copying back the ~ backup file.

After a discussion on https://www.reddit.com/r/emacs/comments/1f7nz9e/reverting_to_worktree_version_after/, magit/magit#5218, and some debugging, the culprit issue seems to be at poetry.el's side.

Somehow, when doing magit-diff-visit-file on a removed line, the blob's buffer shows up, followed by messages "Compilation finished" and "Poetry finished", after which the worktree file buffer is reverted.

However, figuring out which specific command actually changes the contents of the worktree file is rather tough to debug. I suspect some kind of hook function, but thus far my hypotheses were not successful.

Any idea what could go wrong?

PS: I'm using poetry.el with the latest lsp-mode on Emacs 29.3.

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 a pull request may close this issue.

1 participant