Jeff King <peff@xxxxxxxx> writes: > On Wed, Jul 05, 2017 at 03:45:03PM -0700, Junio C Hamano wrote: > >> > I did make the ordering intentional. We process each reflog sequentially >> > in turn. I don't think it would be wrong to interleave them by date, but >> > I actually think it's useful for somebody who switches that behavior to >> > consciously update the test. Maybe it's worth calling out in the commit >> > message. >> > >> > I stopped short of actually documenting and guaranteeing that behavior >> > to the user. I don't know how comfortable we would be changing it later. >> >> I somehow feel that the "showing all entries from HEAD and then >> showing all from side" is simply a buggy behaviour. I do not think >> our users would terribly mind if we changed it later. But I may be >> missing the reason why (sometimes?) the sequential behaviour may be >> useful. > > If we think it's buggy, we can fix it now. But I'm not convinced that > sequential iteration is that bad. It's at least _simple_ and easy to > explain. Yes, I agree that sequential is easy to explain, but only when I consider use of "log" family without "-n 30" or "--since 3.days". It still is easy to explain---we show from one and then from the other, but because we stop after showing 30 of them, and the first one has more than that, you do not see any from the latter. It's just the easy-to-explian behaviour is not very useful and very hard to defend. > The only other thing that would make sense to me is sorting the > entries by date (reflog date, not commit date) and showing them in that > order. But that gives rise to some funny corner cases. > > What do we do if there's clock skew within the reflog (e.g., somebody > fixed their skewed clock such that HEAD@{5} is less recent than > HEAD@{6}). Do we show them out of order then (even if only a single > reflog is being shown?). I would think the easiest-to-explain thing is handle clock skew just like how clock skew affects the traversal with commit date. At least inside a single reflog, there is no need to sort---its append-only nature gives a reliable "newer to older" order. > But maybe we could do a pseudo-list-merge, where we treat the reflogs as > queues and always pick from the queue with the most recent timestamp. Yes, that was what I had in mind. An entry with an artificially old timestamp due to clock skew would clog the output and prevent the entries behind it on the same reflog from getting shown before entries from other reflog, but that is the same as what happens in the normal traversal to sane parents that can only be reached from a child commit that has an artificially old timestamp. Thanks.