Re: git and time
- From
Junio C Hamano <junkio@cox.net>
- Date
- Sep 29, 2006, 22:27 UTC
- Message-ID
- <7vd59ejokp.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <Pine.LNX.4.64.0609281029300.9349@xanadu.home>
Nicolas Pitre <nico@cam.org> writes:
Show 24 quoted lines
> On Wed, 27 Sep 2006, Junio C Hamano wrote: > >> Nicolas Pitre <nico@cam.org> writes: >> >> > SYNOPSIS >> > >> > git-local-arrival <committish> >> > >> > DESCRIPTION >> > >> > The command displays the time when given commit appeared in the >> > local repository. >> >> This should be certainly doable, but local-arrival may not be >> interesting if the repository has more than one branches. Maybe >> >> git-local-arrival <committish> [<branch>] >> >> which defaults to the current branch? > > Indeed. I didn't mention it initially because it is really easy to do > once you have it working for the current branch. The technical > challenge is about making it efficient to find out which reflog entry > with a path to given commit is the oldest.
The more I think about this, if we were to add yet another command, I think it should be a command that lets us inspect ref-log. We do not have an UI other than @{time} syntax to interact with it right now.
What are the things we would want? Here is a strawman.
- List when and how a branch was changed.
git ref-log --list --type=merge next (when did I merge into my 'next'?) git ref-log --list --type=merge (ditto but any branches) git ref-log --list next (any changes not just 'merge')
I expect the output would give timestamp and reason comment; in addition the branch name when no branch is specified. Type does not have to be a concrete thing -- it could just be a substring match in the reason comment string.
Also we would limit output with -n <limit>. The output should be sorted by the timestamp of ref-log entry -- we are talking about a particular repository's ref-log, so its timestamp has more sane meaning than in distributed case. - Find which branches currently contains a commit, and find the earliest time that the commit became part of each of them.
git ref-log $commit next master (when did it enter 'next' and
when did it graduate to 'master'?)
git ref-log $commit (ditto but any branches)I expect the output to be the timestamp and reason comment; in addition the branch name when no branch is specified.
Also for a shared repository, the person who made the change would be a reasonable thing to report.
So for consistency, in all cases we could make the output format like this:
branch SP time-and-zone SP name SP email SP reason-comment LF
where time-and-zone is human-readable timestamp as we see in git-log output.