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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 05, 2010 at 03:22:01PM -0400, tytso@xxxxxxx wrote:
...

I'm going to play with this patch locally a little bit, but I'm all for it.

> From d5659084435a885e05a8fc9afbffe8cdd9535828 Mon Sep 17 00:00:00 2001

Speaking of weird timestamps...2001?  Where did that come from? :)

> From: Theodore Ts'o <tytso@xxxxxxx>
> Date: Sun, 4 Jul 2010 22:06:08 -0400
> Subject: [PATCH] guilt: Make sure the commit time is increasing
> 
> Git has various algorithms, most notably in git rev-list, git
> name-rev, and others, which depend on the commit time increasing.  We
> want to keep the commit time the same as much as possible, but if
> necessary, adjust the time stamps of the patch files to obey this
> constraint.
> 
> Signed-off-by: "Theodore Ts'o" <tytso@xxxxxxx>
> ---
>  guilt |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/guilt b/guilt
> index b6e2a6c..edcfb34 100755
> --- a/guilt
> +++ b/guilt
> @@ -535,6 +535,17 @@ commit()
>                          export GIT_AUTHOR_EMAIL="`echo $author_str | sed -e 's/[^<]*//'`"
>  		fi
>  
> +		ct=$(git log -1 --pretty=%ct)
> +		if [ $ct -gt $(stat -c %Y "$p") ]; then
> +		    echo "Adjusting mod time of" $(basename "$p")

Depending on how my playing goes, I might remove the echo.

> +		    ct=$(expr $ct + 60)

So, ct is now the +1min time.

> +		    if [ $ct -gt $(date +%s) ]; then
> +			touch "$p"
> +		    else
> +			touch -d @$(expr $ct + 60) "$p"

And we're touching +1+1min.  I'll fix it up before applying.

Thanks,

Jeff.

-- 
NT is to UNIX what a doughnut is to a particle accelerator.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]