summaryrefslogtreecommitdiffstats
path: root/src/cmd/acme/dat.h
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2017-10-10 13:49:37 -0400
committerRuss Cox <rsc@swtch.com>2017-10-10 13:51:24 -0400
commit67dbeee5fe9e2a855384048615bafe100e876f4c (patch)
treef5e2960b2bf7abcc774678b65f947aac792c7fd0 /src/cmd/acme/dat.h
parent680c57a15c51c302d89aec134e25f08820d3f30d (diff)
downloadplan9port-67dbeee5fe9e2a855384048615bafe100e876f4c.tar.gz
plan9port-67dbeee5fe9e2a855384048615bafe100e876f4c.zip
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.)
Diffstat (limited to 'src/cmd/acme/dat.h')
-rw-r--r--src/cmd/acme/dat.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cmd/acme/dat.h b/src/cmd/acme/dat.h
index df1a6422..8c4b14ee 100644
--- a/src/cmd/acme/dat.h
+++ b/src/cmd/acme/dat.h
@@ -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);