Hi, attached is a patch that adds the option mbox_keep_mtime to mutt. When unset, nothing is changed in the way mutt behaves. When set, mutt will not restore the modification time when syncing (saving the currently open) mailbox for mbox style mailboxes. Rationale: I'm planning to put my entire home directory under version control with subversion and started to use my Mail folders as a test case. What a good test case indeed. I found out that when I open a mailbox in mbox format, delete a couple of mails (without adding any!), and then save the mailbox, 'svn diff' (subversion) will not notice any changes. It appears that svn realizes that the mtime of the file has not changed and doesn't bother to actually diff the file. This corrupts subversion's view of my filesystem. With my patch, when I set mbox_keep_mtime, svn will correctly notice the changes to the folder. I posted this during the week to mutt-users, but didn't receive any feedback, so I post it here again. Ciao, Viktor -- !!! Listen live to reboot.fm !!! Tune in to 104.10 MHz if you're in Berlin, Germany or listen to the internet stream at http://www.reboot.fm/stream/ .
diff -ur mutt-1.5.5.1/init.h mutt-1.5.5.1.vrr/init.h --- mutt-1.5.5.1/init.h 2003-11-05 10:41:32.000000000 +0100 +++ mutt-1.5.5.1.vrr/init.h 2004-03-18 20:57:56.611362136 +0100 @@ -1024,6 +1024,15 @@ ** This specifies the folder into which read mail in your ``$$spoolfile'' ** folder will be appended. */ + { "mbox_keep_mtime", DT_BOOL, R_NONE, OPTMBOXKEEPMTIME, 0 }, + /* + ** .pp + ** If set, mutt will not change the the modification time of an mbox + ** file if mails are only deleted from the file. If unset, mutt will + ** modify the modification time. This is necessary for some version + ** control systems such as svn, but may confuse some xbiff style mail + ** checkers. + */ { "mbox_type", DT_MAGIC,R_NONE, UL &DefaultMagic, M_MBOX }, /* ** .pp Nur in mutt-1.5.5.1.vrr/: .init.h.swo. diff -ur mutt-1.5.5.1/mbox.c mutt-1.5.5.1.vrr/mbox.c --- mutt-1.5.5.1/mbox.c 2003-11-05 10:41:32.000000000 +0100 +++ mutt-1.5.5.1.vrr/mbox.c 2004-03-18 20:59:10.503128880 +0100 @@ -935,10 +935,12 @@ return (-1); } - /* Restore the previous access/modification times */ - utimebuf.actime = statbuf.st_atime; - utimebuf.modtime = statbuf.st_mtime; - utime (ctx->path, &utimebuf); + if (option(OPTMBOXKEEPMTIME)) { + /* Restore the previous access/modification times */ + utimebuf.actime = statbuf.st_atime; + utimebuf.modtime = statbuf.st_mtime; + utime (ctx->path, &utimebuf); + } /* reopen the mailbox in read-only mode */ if ((ctx->fp = fopen (ctx->path, "r")) == NULL) diff -ur mutt-1.5.5.1/mutt.h mutt-1.5.5.1.vrr/mutt.h --- mutt-1.5.5.1/mutt.h 2003-11-05 10:41:32.000000000 +0100 +++ mutt-1.5.5.1.vrr/mutt.h 2004-03-18 20:58:14.609625984 +0100 @@ -373,6 +373,7 @@ OPTMAILDIRTRASH, OPTMARKERS, OPTMARKOLD, + OPTMBOXKEEPMTIME, /* keep mtime? */ OPTMENUSCROLL, /* scroll menu instead of implicit next-page */ OPTMETAKEY, /* interpret ALT-x as ESC-x */ OPTMETOO,
Attachment:
signature.asc
Description: Digital signature