unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Felix Geller <fgeller@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH] Change in increment_mtime for BSD compatibility of test suite
Date: Wed, 25 May 2011 15:07:52 +0200	[thread overview]
Message-ID: <m2sjs3q66v.fsf@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]

Use `-t' option rather than `-d' which is not supported by BSD's
touch. I'm not sure whether this is the cleanest way to do this, please
let me know if there is a better way. There are additional changes
(e.g., sed does not support `-r' but instead `-E') but they seem to be
incompatible between GNU and BSD. What's the recommended way to handle
this?

Cheers,
Felix


diff --git a/test/test-lib.sh b/test/test-lib.sh
index f536172..d2af857 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -218,9 +218,10 @@ increment_mtime_amount=0
 increment_mtime ()
 {
     dir="$1"
-
+    last_mod_date=`date -j -f %Y%m%d%H%M%S \`stat -f %Sm -t %Y%m%d%H%M%S ${dir}\` +%s`
     increment_mtime_amount=$((increment_mtime_amount + 1))
-    touch -d "+${increment_mtime_amount} seconds" "$dir"
+    new_date=`date -j -r ${last_mod_date} -v+${increment_mtime_amount}S +%Y%m%d%H%M.%S`
+    touch -t ${new_date} ${dir}
 }
 
 # Generate a new message in the mail directory, with a unique message

[-- Attachment #2: Type: application/pgp-signature, Size: 202 bytes --]

             reply	other threads:[~2011-05-25 13:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-25 13:07 Felix Geller [this message]
2011-05-26 22:12 ` [PATCH] Change in increment_mtime for BSD compatibility of test suite Carl Worth
2011-05-30 12:40   ` Felix Geller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2sjs3q66v.fsf@gmail.com \
    --to=fgeller@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).