--- a/mercurial/store.py Thu Jul 13 19:26:45 2023 +0100
+++ b/mercurial/store.py Thu Jul 13 19:36:43 2023 +0100
@@ -1093,12 +1093,13 @@
):
# do not trigger a fncache load when adding a file that already is
# known to exist.
- notload = self.fncache.entries is None and self.vfs.exists(encoded)
- if notload and b'r+' in mode and not self.vfs.stat(encoded).st_size:
- # when appending to an existing file, if the file has size zero,
- # it should be considered as missing. Such zero-size files are
- # the result of truncation when a transaction is aborted.
- notload = False
+ notload = self.fncache.entries is None and (
+ # if the file has size zero, it should be considered as missing.
+ # Such zero-size files are the result of truncation when a
+ # transaction is aborted.
+ self.vfs.exists(encoded)
+ and self.vfs.stat(encoded).st_size
+ )
if not notload:
self.fncache.add(path)
return self.vfs(encoded, mode, *args, **kw)
--- a/tests/test-transaction-rollback-on-revlog-split.t Thu Jul 13 19:26:45 2023 +0100
+++ b/tests/test-transaction-rollback-on-revlog-split.t Thu Jul 13 19:36:43 2023 +0100
@@ -425,14 +425,6 @@
.hg/store/data/file.d: size=267307
.hg/store/data/file.i: size=320
$ hg verify -q
- warning: revlog 'data/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/f.d' not in fncache!
- warning: revlog 'data/Directory_With,Special%Char/Complex_File.babar.d' not in fncache!
- warning: revlog 'data/file.d' not in fncache!
- warning: revlog 'data/foo/bar/babar_celeste/foo.d' not in fncache!
- warning: revlog 'data/some_dir/sub_dir/foo_bar.d' not in fncache!
- warning: revlog 'data/some_dir/sub_dir/foo_bar.i.s/tutu.d' not in fncache!
- 6 warnings encountered!
- hint: run "hg debugrebuildfncache" to recover from corrupt fncache
$ cd ..