git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shawn Pearce <spearce@spearce.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: [RFC 5/5] Support 'master@2 hours ago' syntax
Date: Wed, 17 May 2006 18:06:13 -0400	[thread overview]
Message-ID: <20060517220613.GC30313@spearce.org> (raw)
In-Reply-To: <7vbqtwhpum.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano <junkio@cox.net> wrote:
> Shawn Pearce <spearce@spearce.org> writes:
> 
> +	fprintf(stderr, "warning: Log %s only goes back to %s.\n",
> +		logfile, show_rfc2822_date(date, tz));
> +	return 0;
> 
> I am not sure about this part.  If the oldest log entry was 3
> hours ago, the second oldest 2 hours ago, we can tell during
> that one hour period the ref was at that point.  If the user
> asked "ref as of four hours ago", and if the oldest log entry
> had old SHA1 that is not 0{40} (because the log was not enabled
> before that record), it might make more sense to give that back.

If I understand my own code here what I'm doing is walking back
in the log file, realizing I fell off the first line of it, then
loading the old ref from the first line.  This is the oldest ref
I can find so I return it as a valid ref to the caller but I'm
printing out this warning to tell the user that the oldest point
in time I found in the log is effectively the update date as I have
no idea when that old sha1 first became the value of the ref.

So I think I'm doing what you are expecting here.  The log will start
with the value in the ref at the time the log started, not 0{40}
and that value is what gets returned when we have this warning
come out..  That's the best anyone can expect...

> Also I wonder how much complexity would we suffer and how much
> efficiency would we gain if we binary search the logdata (the
> committer info is variable length, so you would need to resync
> in each step).

I thought about doing this but did not think it would be worth the
effort (either developer to code or CPU to execute) at this point
in time.  I don't think users will be pulling refs from the log very
often and if they are they will probably be pulling from recent time,
not very far back.  Thus starting at the end and walking back is
probably "good enough".

But if it proves to be too slow in practice I'm sure I can come up
with a faster way to walk through the log.  :-)

-- 
Shawn.

  parent reply	other threads:[~2006-05-17 22:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-17  9:56 [RFC 5/5] Support 'master@2 hours ago' syntax Shawn Pearce
2006-05-17 11:07 ` Junio C Hamano
2006-05-17 14:46   ` Linus Torvalds
2006-05-17 18:32     ` Junio C Hamano
2006-05-17 21:39       ` Shawn Pearce
2006-05-17 22:06   ` Shawn Pearce [this message]
2006-05-17 22:32     ` Shawn Pearce

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=20060517220613.GC30313@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.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).