git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>, git@vger.kernel.org
Subject: Re: jk/tag-contains (Re: What's cooking in git.git (Jul 2010, #05; Wed, 28))
Date: Thu, 5 Aug 2010 13:56:40 -0400	[thread overview]
Message-ID: <20100805175640.GB15760@sigill> (raw)
In-Reply-To: <7vocdlpsmw.fsf@alter.siamese.dyndns.org>

On Sun, Aug 01, 2010 at 09:04:23PM -0700, Junio C Hamano wrote:

> Sorry, but I am right in the middle of phisically moving, so my weekend
> and evening git time has been nil recently.

Didn't you just do that? ;P

> >> Additional things to do (this is mostly a note to myself):
> >> 
> >>  - refuse to commit with a timestamp long before any parent
> >
> > Agreed.
> 
> You need to be careful here, though.  What if you pulled from somebody
> whose clock is set grossly in the future?

Reading the rest of this thread and thinking about it more, I think
warning is the best thing we can do. Because only the user is in a
position to know whether it is their clock or the previous commit that
is in error. And if it is the previous commit, then only the user knows
what the next logical step is: redo the commit, complain to somebody
else, or just ignore and continue.

> I wonder if we can make fsck to notice a commit with a wrong timestamp
> (i.e. older than some of its parents) and make a note of it (hopefully
> they are miniscule minority)---then during the revision traversal when we
> hit such a commit, we perhaps ignore its timestamp (pretending as if its
> timestamp is one of its children or parent---I haven't thought about the
> details, but the note fsck leaves can record what adjusted timestamp
> should be used) to fix the issue?

That's basically a finer-grained version of what I implemented. Mine
finds the _worst_ skew for the whole graph, and never lets you optimize
a traversal cutoff more than that skew. So it is nicely bounded
space-wise, as it is always a single integer, but you waste effort on
the entire traversal because a couple of commits are skewed. Yours
optimizes perfectly, but needs O(skewed commits) storage. Which is
probably a better tradeoff when the number of skewed commits is tiny
(which is what we expect).

I think your technique would work, but with one note. You probably want
to pull the timestamp from the parent (pulling from the child makes no
sense to me, as there can be an infinite number of children), but you
need to process the parent first and pull from its _corrected_
timestamp. Because at least in the linux-2.6 case, there is a run of
skewed commits. So if you have something like:

  A -- B -- C -- D

A, timestamp = 1000
B, timestamp = 900
C, timestamp = 950
D, timestamp = 1100

where obviously the timestamps are shortened to be readable, but are
meant to be seconds-since-epoch.  You'd probably want to end up with:

A, timestamp = 1000
B, timestamp = 1001
C, timestamp = 1002
D, timestamp = 1100

which means recursing all the way to the root, and fixing timestamps as
you back out.

This seems like just a straight sha1->int mapping, which presumably one
could do using "git notes". Though I worry it could slow down traversal
for all of the lookup misses for non-skewed commits.

-Peff

  parent reply	other threads:[~2010-08-05 17:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-29  4:00 What's cooking in git.git (Jul 2010, #05; Wed, 28) Junio C Hamano
2010-07-30 18:37 ` Jeff King
2010-07-31  6:07   ` jk/tag-contains (Re: What's cooking in git.git (Jul 2010, #05; Wed, 28)) Jonathan Nieder
2010-07-31 12:33     ` Jeff King
2010-08-02  4:04       ` Junio C Hamano
2010-08-02 20:02         ` Jonathan Nieder
2010-08-02 20:08           ` Matthieu Moy
2010-08-02 20:19             ` jk/tag-contains Jonathan Nieder
2010-08-02 22:38               ` jk/tag-contains Junio C Hamano
2010-08-05 17:56         ` Jeff King [this message]
2010-08-05 18:22           ` jk/tag-contains (Re: What's cooking in git.git (Jul 2010, #05; Wed, 28)) Junio C Hamano
2010-08-05 19:35             ` Jeff King

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=20100805175640.GB15760@sigill \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    /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).