Page MenuHomePhabricator

commit: prevent possible race that results in bad dirstate
AbandonedPublic

Authored by valentin.gatienbaron on Nov 10 2021, 8:24 PM.

Details

Reviewers
marmoute
Group Reviewers
hg-reviewers
Summary

I'm getting reports of wrongly clean hg status, that get fixed by
running hg debugrebuilddirstate, which I suspect is the issue
below. And if it's not, it still seems good to fix.

hg commit works by adding new version of files from the working copy
into the store, then later lstat'ing the files in the working copy to
mark them as clean in the dirstate. This is racy, since the files can
be modified in the meantime.

Reduce the race by doing the lstat immediately after adding new file
versions into the store, and guarantee that the file size recorded in
the dirstate is correct (i.e. is the file size from the store).

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

marmoute requested changes to this revision.Dec 3 2021, 12:09 PM
marmoute added a subscriber: marmoute.

I can confirm that his changeset is no longer necessary now that no longer try to record dirstate cache during hg commit.

This revision now requires changes to proceed.Dec 3 2021, 12:09 PM