summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2006-05-29 05:06:04 +0000
committerJoris Vink <joris@cvs.openbsd.org>2006-05-29 05:06:04 +0000
commitc6e4dc78ab29fab11e263b608249ce3d38c67839 (patch)
treebe6ce8807f4cd3c036b6fc57089a7c7226e7cf2f /usr.bin
parente5c9328350baef376202fc4bef97d4d7f6bec10b (diff)
if the timestamp of the file has changed and
no longer matches the timestamp in the CVS/Entries file, be sure to compare the file contents to the revision contents to be positive the file actually changed. otherwise we would see a file as modified if somebody would for example open it in vi and simply :wq it.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/file.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index 7612dc0190d..03c20b8a02a 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.148 2006/05/28 23:38:42 pedro Exp $ */
+/* $OpenBSD: file.c,v 1.149 2006/05/29 05:06:03 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
@@ -541,6 +541,7 @@ cvs_file_classify(struct cvs_file *cf, int loud)
size_t len;
time_t mtime;
struct stat st;
+ BUF *b1, *b2;
int rflags, l, ismodified, rcsdead, verbose;
CVSENTRIES *entlist = NULL;
const char *state;
@@ -637,6 +638,25 @@ cvs_file_classify(struct cvs_file *cf, int loud)
ismodified = 1;
}
+ if (ismodified == 1 && cf->fd != -1 && cf->file_rcs != NULL) {
+ b1 = rcs_getrev(cf->file_rcs, cf->file_rcs->rf_head);
+ if (b1 == NULL)
+ fatal("failed to get HEAD revision for comparison");
+
+ b1 = rcs_kwexp_buf(b1, cf->file_rcs, cf->file_rcs->rf_head);
+
+ /* XXX */
+ b2 = cvs_buf_load(cf->file_path, BUF_AUTOEXT);
+ if (b2 == NULL)
+ fatal("failed to get file content for comparison");
+
+ /* b1 and b2 get released in cvs_buf_differ */
+ if (cvs_buf_differ(b1, b2))
+ ismodified = 1;
+ else
+ ismodified = 0;
+ }
+
if (cf->file_rcs != NULL) {
state = rcs_state_get(cf->file_rcs, cf->file_rcs->rf_head);
if (state == NULL)