From 0922109dbb1fe2e025e9550628149e0b09946f54 Mon Sep 17 00:00:00 2001 From: Andreas Waidler Date: Sat, 23 Apr 2011 21:04:45 +0200 Subject: [PATCH] Changed nomtime to work from outside of feed directory. --- TODO | 1 - nomtime | 10 +++++++--- tests_usr.sh | 4 +--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index 513c8f0..6dc4088 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,3 @@ -* make nomtime work from parent dir * QA * test for buffer overflows when reading from global buffer into special ones (item, etc). diff --git a/nomtime b/nomtime index b8f7308..a6744a8 100755 --- a/nomtime +++ b/nomtime @@ -6,9 +6,13 @@ # # 0. You just DO WHAT THE FUCK YOU WANT TO. -MTIME="`stat -c %y .`" -eval "$*" +# Runs $1 with $2 as parameter while ensuring that the +# mtime of the parent directory of $2 is not changed. + +DIR="`dirname \"$2\"`" +MTIME="`stat -c %y \"$DIR\"`" +"$1" "$2" res=$? -touch -md "$MTIME" . +touch -md "$MTIME" "$DIR" exit $res diff --git a/tests_usr.sh b/tests_usr.sh index 9f3b956..731d189 100755 --- a/tests_usr.sh +++ b/tests_usr.sh @@ -33,14 +33,12 @@ function agg_fail() function agg_clean() { - cd "$FEED" - find -type f -exec ../nomtime "rm '{}'" \; + find "$FEED" -type f -exec ./nomtime rm '{}' \; res=$? if [ $res -ne 0 ]; then echo "Failed to run nomtime." exit 1 fi - cd .. } function cleanup() -- 2.11.4.GIT