Re: [PATCH/RFC] rev-list: add --authorship-order alternative ordering
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:57:34
Elliott Cable [off-list ref] writes:
quoted
And update revs->lifo to use that same enum, without adding use_author_date bit to rev_info.I'll look into replacing lifo with an enum as soon as I can sit back down to update this patch. For the moment, nothing more than committer_date_sort and author_date_sort, I suppose?
I'll try and make this a separate patch. First commit, to replace lifo with an enum; second commit, to *actually implement* the code obeying that enum when it is set to author_date_order.
If you want to do this in a multi-step series (which may not be a bad idea), I would imagine that the enum starts as a choice between the two: traversal-order vs committer-date-order. The first patch would change nothing else. And then you would add the third choice, author-date-order, and implement the logic to sort them using author instead of committer date in the same patch.
quoted
Elliott: you can see the relevant changes to the topo-sort in commit 96c4f4a (commit: allow associating auxiliary info on-demand, 2013-04-09). -PeffAgain, might be a little over my head. If you really think it's best that I look into that branch, I will try. :) Meantime, is there any other, more-immediate approach you can think of? I thought, for a moment, of only storing *either* the committer *or* the author date in the commit-struct at a given time, and flagging with a single bit ... but I'm not sure how widely-spread the nead for committer-date currently is. Maybe I can go back and parse-out the author date *when I need it*, instead, though that sounds slow …
You would parse all of them at the beginning of topo-sort function once and store these dates in the commit-info-slab (alongside with indegree). Once you are done sorting, you can discard the slab. This could be done as a follow-up patch, but the tons of helper functions you added to compare by author date to revision.c will have to be removed in such a transition, because the whole point of using commit-info-slab is not to have commit->author_date field, which these new helpers work on.