Re: git push hook to check for outdated timestamps

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: git push hook to check for outdated timestamps
Date: 2015-06-14 10:37:00
Message-ID: CABUevEx4FfYxOg_U+-zPvEahuAAiKrFKaFW0SH2pnqbYnkcmWQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 12, 2015 at 4:33 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> > On 06/12/2015 09:31 AM, Robert Haas wrote:
> >> Could we update our git hook to refuse a push of a new commit whose
> >> timestamp is more than, say, 24 hours in the past? Our commit history
> >> has some timestamps in it now that are over a month off, and it's
> >> really easy to do, because when you rebase a commit, it keeps the old
> >> timestamp. If you then merge or cherry-pick that into an official
> >> branch rather than patch + commit, you end up with this problem unless
> >> you are careful to fix it by hand. It would be nice to prevent
> >> further mistakes of this sort, as they create confusion.
>
> > I think 24 hours is probably fairly generous,
>
> Yeah ... if we're going to try to enforce a linear-looking history, ISTM
> the requirement ought to be "newer than the latest commit on the same
> branch". Perhaps that would be unduly hard to implement though.
>

From a quick look at our existing script, I think that's doable, but I'd
have to do some more detailed verification before I'm sure. And we'd have
to figure out some way to deal with a push with multiple commits in it, but
it should certainly be doable if the first one is.

Would we in that case want to enforce linearity *and* recent-ness, or just
linearity? as in, do we care about the commit time even if it doesn't
change the order?

FWIW, our git_changelog script tries to avoid this problem by paying
> attention to CommitDate not Date. But I agree that it's confusing when
> those fields are far apart.
>

That brings it back to the enforcing - would we want to enforce both those?

(And to confuse it even more, Date gets renamed to AuthorDate when you do a
full log.. But AFAIK it's the same date, they just change the name of it)

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Petr Jelinek 2015-06-14 10:37:19 Re: 9.5 release notes
Previous Message Shay Rojansky 2015-06-14 10:06:02 Re: Entities created in one query not available in another in extended protocol