Bug 387358 - Kate reloads version-controlled files from disk without confirmation when using the project plugin
Summary: Kate reloads version-controlled files from disk without confirmation when usi...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-ktexteditor
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: 5.91.0
Platform: Debian unstable Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-27 16:41 UTC by nfxjfg
Modified: 2022-06-16 14:35 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 5.96.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nfxjfg 2017-11-27 16:41:44 UTC
If a file changes on disk, kate normally shows a warning dialog and offers to load the changes from disk or to overwrite the file on disk with the current editor contents.

After a recent update, it stopped doing this, and reloads the file without confirmation. I'm not sure when exactly this changed.

If this is a feature instead of a bug, I'd like to have a way to enable the old behavior.

The "warn about files modified by foreign process" checkbox in the settings is checked. This is about the case when there are no unsaved changes in the editor.
Comment 1 nfxjfg 2017-11-27 16:43:56 UTC
PS: as a barely related bug, I've observed that kate _failed_ to reload changes from disk (after showing the confirmation dialog and instructing it to reload). This is probably an unrelated bug. Reproduction is hard and sporadic. Manually reloading works. Is this known/fixed yet?
Comment 2 Dominik Haumann 2017-12-03 22:41:52 UTC
How do the files on disk change?

Do you use git pull, and then the files change? Or is it not version controlled?

I am asking, since for git controlled files, we do not show a reload message anymore, since the reload is wanted in 99% of the time (i.e. many users like this).
Comment 3 nfxjfg 2017-12-03 22:48:41 UTC
Yes, this is in git repos.

I definitely want the old behavior. There are a lot of cases where you can actually lose the data forever, and in a few cases the reload notification saved me. (Cases include e.g. git reset --hard.)
Comment 4 nfxjfg 2017-12-24 01:17:04 UTC
I'm still disliking this very much. Just because a file is git managed, it doesn't mean you can't lose parts of its contents. For example, this clears the undo stack. I'd also like more control over this whole thing (this automatism and bugs like #388186 aren't very confidence inducing).
Comment 5 nfxjfg 2018-06-29 14:20:04 UTC
Can you please consider adding an option to disable this behavior? I already lost a bunch of changes because of it.

I know other editors reload by default, but that doesn't change that this behavior is fucking dumb.
Comment 6 Lucas 2018-11-26 20:24:28 UTC
here Nicolas is working to remove the confirmation: https://bugs.kde.org/show_bug.cgi?id=401376
Comment 7 Lothar 2018-12-29 16:00:02 UTC
> I already lost a bunch of changes because of it.

The "auto-reload" code checks if there is a matching git blob...
https://cgit.kde.org/ktexteditor.git/tree/src/document/katedocument.cpp#n4831
...so your lost changes should still be there. "git reflog" may helpful. 

Would be nice when the "undo" action would work in such a case
Comment 8 Justin Zobel 2020-11-13 03:32:41 UTC
I get a prompt every time now if a file is modified externally.

Can you please test and confirm if this issue is still occurring or if this bug report can be marked as resolved. I'm setting status to "needsinfo" pending your response, please change back to "reported" or "resolved" when you respond, thanks.
Comment 9 nfxjfg 2020-11-13 12:36:24 UTC
This happens with the project plugin and files under version control. From what I understand, if the modified file contents were committed to git at some point, kate will always reload it without asking.

It works as expected for files not under version control.
Comment 10 Christoph Cullmann 2022-03-06 21:36:19 UTC
This is a feature of KTextEditor.
We might want to add a config option to forbid this.
Comment 11 Christoph Cullmann 2022-06-16 14:35:01 UTC
https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/382

Next KTextEditor version will have config option to turn this off.