DVC post-checkout hook complains that it can't remove unsaved files without confirmation, but these files have not changed.
We currently upgraded from dvc 2.58.1 to 3.55.2. After a while with no problems, I noticed that our post-checkout hook sometimes fails, complaining that it can't remove unsaved files without confirmation. At first I believed this was just actually having unsaved files, so I did dvc checkout --force a few times. However, the problem kept coming back every now and then when switching to different branches.
I then started to do some digging. First, I noticed that even though the post-checkout hook was failing due to unsaved files, dvc status showed no changes. Furthermore, the md5 hash for the "unsaved" file in question (which I computed with md5 filename) exactly matched the one in the .dir file in the cache (this file is inside a folder which is an output of one of our stages). Lastly, I also noticed that the md5 of the file does not change after dvc checkout --force, even though I get an Applying changes M ./ printout.
At the moment I don't really know what the problem is, and would appreciate assistance.
Reproduce
I am not able to reproduce this at will. Haven't yet figured out exactly what makes this happen.
Expected
DVC post-checkout hook would complete without errors if I don't have any unsaved files. Alternatively, if I do have unsaved files, I would expect dvc status to point them to me, or at least that their MD5 hash would not match the one tracked by dvc (and then match it after something like dvc checkout --force).
Bug Report
Description
DVC post-checkout hook complains that it can't remove unsaved files without confirmation, but these files have not changed.
We currently upgraded from dvc 2.58.1 to 3.55.2. After a while with no problems, I noticed that our post-checkout hook sometimes fails, complaining that it can't remove unsaved files without confirmation. At first I believed this was just actually having unsaved files, so I did
dvc checkout --force
a few times. However, the problem kept coming back every now and then when switching to different branches.I then started to do some digging. First, I noticed that even though the post-checkout hook was failing due to unsaved files,
dvc status
showed no changes. Furthermore, the md5 hash for the "unsaved" file in question (which I computed withmd5 filename
) exactly matched the one in the.dir
file in the cache (this file is inside a folder which is an output of one of our stages). Lastly, I also noticed that the md5 of the file does not change afterdvc checkout --force
, even though I get anApplying changes M ./
printout.At the moment I don't really know what the problem is, and would appreciate assistance.
Reproduce
I am not able to reproduce this at will. Haven't yet figured out exactly what makes this happen.
Expected
DVC post-checkout hook would complete without errors if I don't have any unsaved files. Alternatively, if I do have unsaved files, I would expect
dvc status
to point them to me, or at least that their MD5 hash would not match the one tracked by dvc (and then match it after something likedvc checkout --force
).Environment information
Output of
dvc doctor
:Pre-commit configuration: