[prev in list] [next in list] [prev in thread] [next in thread]
List: cgit
Subject: Re: Feature Request: show ages in tree view
From: John Keeping <john () keeping ! me ! uk>
Date: 2016-11-24 18:56:47
Message-ID: 20161124185647.GB24063 () john ! keeping ! me ! uk
[Download RAW message or body]
On Sun, Oct 30, 2016 at 01:22:24PM +0100, Silly Slux wrote:
> i want to see when a file or tree was last changed when i'm watching
> the tree of a repository. I've tried to implement it myself, but it
> seems i can't, though i have something to illustrate what i mean.
This is going to be quite a costly operation because it entails walking
back along the commit graph to see when the relevant path last changed.
The algorithm for doing this has to get the SHA-1 associated with the
tree/blob representing the path of interest and then finding the most
recent commit with a different SHA-1 at that location. Obviously at
merges all parents have to be added to the list of interesting commits.
If you want to try to implement this, Git's commit_list_insert_by_date
function is probably useful for sorting the parent commits. You can see
how this is used in git/builtin/describe.c::describe() which looks to
have the right structure for walking backwards in the history, then you
just need to get the SHA-1 of the relevant path and break as soon as it
changes.
I expect there's a relatively obvious optimization when we're printing
the contents of a tree object to avoid walking the history for every
path that is printed, but I haven't thought about this in detail.
_______________________________________________
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic