Thread (19 messages) flat view 19 messages, 5 authors, 2016-06-15

Re: [PATCH] guilt: Make sure the commit time is increasing

From: tytso@mit.edu
Date: 2016-06-15 22:49:04

On Sun, Jul 04, 2010 at 10:23:59PM -0400, Theodore Ts'o wrote:
+		ct=$(git log -1 --pretty=%ct)
+		if [ $ct -gt $(stat -c %Y "$p") ]; then
+		    echo "Warning time went backwards, adjusting mod time of" \
+			$(basename "$p")
+		    touch -d @$(expr $ct + 60) "$p" || touch "$p"
                                                    ^^^^^^^^^^^^^

hmm, I just realized, this is strictly speaking not necessary.

"stat -c %Y" means that guilt only works if GNU coreutils is
installed, which means that "touch -d @secs-since-epoch" should also
work.

This will be a problem on legacy systems such as Solaris (unless their
path puts the GNU utilities head of their System V-style utilities),
but that's going to be true of guilt in general, it looks like.

      	    	    	     	      - Ted
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help