From: tytso@mit.edu
To: jeffpc@josefsipek.net
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] guilt: Make sure the commit time is increasing
Date: Mon, 5 Jul 2010 15:22:01 -0400 [thread overview]
Message-ID: <20100705192201.GI25518@thunk.org> (raw)
In-Reply-To: <20100705185238.GS22659@josefsipek.net>
On Mon, Jul 05, 2010 at 02:52:38PM -0400, jeffpc@josefsipek.net wrote:
>
> I think we might need a little bit more logic in this patch...
>
> if I commit, and immediately after push 10 patches, wouldn't the HEAD end up
> with a commit that's ~10 minutes in the future?
Hmm, good point. I hadn't considered that case. The most common case
happens when I rebase to a new release, and then do a "guilt push -a".
In that case the time that start with isn't "now", but whenver the
last release happened, which is typically far enough in the past that
we don't end up in the future. However, I agree that's a concern.
How about this?
> I do like the idea of git-commit warning/erroring, but I don't think that
> guilt issuing a warning is necessary. Afterall, it's only a timestamp
> change. It might be a bit of a shock for anyone looking at the timestamps
> expecting them to be out of order (based on the patch times), but I think
> it's better than warning all the time.
I guess I didn't worry too much since "guilt push -a" is pretty noisy
anyway. I've shortened the message, but if you think it's better to
pull the message altogether feel free...
- Ted
>From d5659084435a885e05a8fc9afbffe8cdd9535828 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
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@mit.edu>
---
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")
+ ct=$(expr $ct + 60)
+ if [ $ct -gt $(date +%s) ]; then
+ touch "$p"
+ else
+ touch -d @$(expr $ct + 60) "$p"
+ fi
+ fi
+
# must strip nano-second part otherwise git gets very
# confused, and makes up strange timestamps from the past
# (chances are it decides to interpret it as a unix
--
1.7.0.4
next prev parent reply other threads:[~2010-07-05 19:22 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-05 2:23 [PATCH] guilt: Make sure the commit time is increasing Theodore Ts'o
2010-07-05 2:51 ` tytso
2010-07-05 3:01 ` jeffpc
2010-07-05 2:59 ` jeffpc
2010-07-05 11:06 ` Theodore Tso
2010-07-05 18:52 ` jeffpc
2010-07-05 19:22 ` tytso [this message]
2010-07-06 8:03 ` Jonathan Nieder
2010-07-06 10:56 ` Theodore Tso
2010-07-06 15:09 ` Jonathan Nieder
2010-07-06 17:12 ` tytso
2010-07-06 17:29 ` Jonathan Nieder
2010-07-06 13:53 ` Erik Faye-Lund
2010-07-06 14:29 ` Jeff King
2010-07-06 15:02 ` Erik Faye-Lund
2010-07-06 17:21 ` tytso
2010-07-06 17:29 ` jeffpc
2010-07-06 18:57 ` tytso
2010-07-14 3:01 ` Josef 'Jeff' Sipek
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100705192201.GI25518@thunk.org \
--to=tytso@mit.edu \
--cc=git@vger.kernel.org \
--cc=jeffpc@josefsipek.net \
/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.
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 NNTP newsgroup(s).