acme: check file content before declaring file "modified since last read"

Bad remote file systems can change mtime unexpectedly,
and then there is the problem that git rebase and similar
operations like to change the files and then change them back,
modifying the mtimes but not the content.

Avoid spurious Put errors on both of those by checking file
content.

(False positive "modified since last read" make the real ones
difficult to notice.)
This commit is contained in:
Russ Cox 2017-10-10 13:49:37 -04:00
parent 680c57a15c
commit 67dbeee5fe
23 changed files with 79 additions and 13 deletions

View file

@ -105,7 +105,7 @@ struct Buffer
};
void bufinsert(Buffer*, uint, Rune*, uint);
void bufdelete(Buffer*, uint, uint);
uint bufload(Buffer*, uint, int, int*);
uint bufload(Buffer*, uint, int, int*, DigestState*);
void bufread(Buffer*, uint, Rune*, uint);
void bufclose(Buffer*);
void bufreset(Buffer*);
@ -135,8 +135,9 @@ struct File
Rune *name; /* name of associated file */
int nname; /* size of name */
uvlong qidpath; /* of file when read */
ulong mtime; /* of file when read */
ulong mtime; /* of file when read */
int dev; /* of file when read */
uchar sha1[20]; /* of file when read */
int unread; /* file has not been read from disk */
int editclean; /* mark clean after edit command */
@ -152,7 +153,7 @@ void fileclose(File*);
void filedelete(File*, uint, uint);
void filedeltext(File*, Text*);
void fileinsert(File*, uint, Rune*, uint);
uint fileload(File*, uint, int, int*);
uint fileload(File*, uint, int, int*, DigestState*);
void filemark(File*);
void filereset(File*);
void filesetname(File*, Rune*, int);