File not marked as 'M' when contents differ from repo

Matt Mackall mpm at selenic.com
Thu Aug 23 09:54:54 CDT 2007


On Thu, Aug 23, 2007 at 02:03:22AM -0700, Junio C Hamano wrote:
> Matt Mackall <mpm at selenic.com> writes:
> 
> > Changes that don't change file time OR size OR mode are indeed not
> > detected.
> 
> We in the git land call this "racy git" problem, and call such
> files "racily clean".
> 
> We have dealt with this problem by checking the contents of
> potentially "racily clean" file whose timestamp match that of
> the index [*1*].  After such a test, if such a "racily clean"
> file is found to be modified, we drop the cached "size" field to
> zero, so that later check with lstat(3) do not have to trigger
> the contents comparison logic again.  The last trick of smudging
> racily clean path takes advantage of the fact that a file with
> 0-byte contents cannot have been modified if the size does not
> change ;-).

Hmm, we've considered the first half of that approach (comparing
against the dirstate timestamp), but I don't think we've considered
the second half.

It's still unfortunate to potentially have to recheck some or very
often all of the files you've just set the state on after each major
operation (checkout, commit).

> *1* I think the rough equivalent in Hg is whatever is described
> in "Tracking Working Directory State" section of:
> 
>     http://www.selenic.com/mercurial/wiki/index.cgi/Design
> 
> can serve the same purpose for this.  Is this what you guys call
> the "manifest"?

No, it's called the dirstate. The manifest is the equivalent of all
the tree blobs in a git changeset and is terminology we share with
Monotone. The changelog points to a manifest which points to each file
revision.

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial mailing list