All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org, Shawn Pearce <spearce@spearce.org>
Subject: Re: [RFC] git reflog show
Date: Mon, 25 Dec 2006 10:07:31 -0800	[thread overview]
Message-ID: <7vwt4fj1cs.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.63.0612251449140.19693@wbgn013.biozentrum.uni-wuerzburg.de> (Johannes Schindelin's message of "Mon, 25 Dec 2006 15:01:54 +0100 (CET)")

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

>> Also I highly doubt visualization based on parents information rewritten 
>> to match the reflog order is of _any_ use.  By rewriting the parenthood, 
>> you are losing the topology and your visualization is no better than 
>> what "tac .git/logs/$ref" would give.
>
> Okay, but if they are _not_ rewritten, we can reuse the log machinery to 
> show the revisions in "upstream..master@{2.hours.ago}", but in the order 
> they came into the local repository.

Shawn's code was about showing where the tip of the branch was,
and I think you are talking about something entirely different,
which I would address later.

A sensible way to reuse existing code to implement Shawn's one
is to add the revisions to rev.pending, and iterate over that
array like "git show" does.  This does not need to touch the
existing revision walking code at all.  The most valuable parts
of the revision walking code are about ancestry traversal and
history simplification with pathspec, neither of which makes
much sense to use when "walking" reflog.  Reflog walking might
want to use the filtering by commit_match() but then it is only
the matter of renaming the function to a bit more specific name
and exporting it.

You can largely reuse the display side of the code that way, and
I think you should be able to hook into the code without making
it too specific to the reflog (perhaps using object->util and/or
a callback) if you need to give extra information (e.g. comments
and commit information from the log).

But it _also_ makes sense to use reflog when the primary thing
we are interested in seeing is not how the tip jumped around,
but seeing how the branch acquired commits, which I think is
what you are suggesting.  What we would want to have is a sort
order different from the existing topo or date, which is "reflog
order".  While I think it makes sense, a naive implementation
would be somewhat expensive.  Instead of sorting topologically
at the end of prepare_revision_walk (you would need to limit the
list if you do this), for each commit, you binary search the
reflog entries to find the earliest one that is the ancestor of
the commit, and use the reflog entry's timestamp as the age of
the commit (it's the first time the branch saw that commit), and
sort commits using that.

  reply	other threads:[~2006-12-25 18:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-23 10:19 [RFC] git reflog show Shawn Pearce
2006-12-23 10:42 ` Junio C Hamano
2006-12-23 14:53   ` Johannes Schindelin
2006-12-24  6:11     ` Shawn Pearce
2006-12-24 12:49       ` Johannes Schindelin
2006-12-24 21:47         ` Junio C Hamano
2006-12-25 14:01           ` Johannes Schindelin
2006-12-25 18:07             ` Junio C Hamano [this message]
2006-12-26  5:48               ` Shawn Pearce
2006-12-26  6:14                 ` Junio C Hamano
2006-12-26 16:14               ` Johannes Schindelin
2006-12-26 19:03                 ` Junio C Hamano
2006-12-26 23:20                   ` Johannes Schindelin
2006-12-26 23:50                     ` Junio C Hamano

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=7vwt4fj1cs.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.