{"thread":{"id":"40262","subject":"Default ordering of git log output","startedAt":"2015-09-03T13:50:23Z","lastAt":"2015-09-03T16:43:49Z","messageCount":2,"participants":["Kirill Likhodedov","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"269316","messageId":"494BA1BD-150F-45A2-BF5D-9A933D9C1344@gmail.com","threadId":"40262","inReplyTo":null,"subject":"Default ordering of git log output","fromName":"Kirill Likhodedov","fromEmail":"kirill.likhodedov@gmail.com","sentAt":"2015-09-03T13:50:23Z","receivedAt":"2015-09-03T13:50:23Z","isPatch":false,"sender":{"key":"kirill.likhodedov@gmail.com","avatar":"https://gravatar.com/avatar/2b7db7c43bdd506a2045f8d0aa738c4cee6dcaaac813b76615e5224305a7e4d2?d=mp&s=160"},"body":"Is it intended behavior that the default git log output (without ordering parameters) can show parents before children? \n\nThe man says:\n    Commit Ordering\n       By default, the commits are shown in reverse chronological order.\nso it tells nothing about parent-to-child relationship.\n\nI‘ve just faced an example in an open source repository, where I reproduced this behavior: a parent is shown before its child. (so if this behavior is not intended I can give the project URL for debugging)\n\nSo could you please clarify:\n1. Is it true that the rule \"no parents before all of its children are shown” is not guaranteed for default ordering?\n\n2. What does \"reverse chronological order” mean? How commits are actually sorted in git log? \n\n// I was always under impression that git log lists commit in the order in which they are “recorded\" to the repository (e.g. pulled), since this seems to be both the fastest way, and also pretty acceptable from the ordering point of view.  \n\nThanks a lot!\n-- Kirill.\n"},{"id":"269339","messageId":"xmqqk2s7lagq.fsf@gitster.mtv.corp.google.com","threadId":"40262","inReplyTo":"494BA1BD-150F-45A2-BF5D-9A933D9C1344@gmail.com","subject":"Re: Default ordering of git log output","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-09-03T16:43:49Z","receivedAt":"2015-09-03T16:43:49Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kirill Likhodedov <kirill.likhodedov@gmail.com> writes:\n\n> Is it intended behavior that the default git log output (without\n> ordering parameters) can show parents before children?\n>\n> The man says:\n>     Commit Ordering\n>        By default, the commits are shown in reverse chronological order.\n> so it tells nothing about parent-to-child relationship.\n\nWhen you do not give order and when your traversal is not \"limited\"\n(i.e. you do not specify A in \"git log A..B\" that tells us where the\ntraversal ends in topological sense), the traversal \"git log\" goes:\n\n - We put HEAD to a queue that holds commits that are further to be\n   processed.\n\n - We pick up the youngest commit from the queue; we show it, and\n   push its parents that haven't been shown to the queue.  We repeat\n   this step until the queue runs out items.\n\nYour history, when a project participant uses a broken clock to\nrecord the committer timestamp, could look like this (topology flows\nfrom left to right):\n\n           1---5---6\n          /   /\n     2---3---4\n\nwhere the labels in the illustration depict the relative order of\ntheir committer timestamps.  Imagine your HEAD is at '6'.\n\nSo \"git log\" would do\n\n    Queue       Action\n    6           show 6, push 5 to the queue\n    5           show 6, push 1 and 4 to the queue\n    4 1         show 4, push 3 to the queue\n    3 1         show 3, push 2 to the queue\n    2 1         show 2; nothing pushed (as it is root)\n    1           show 1; nothing is pushed (as its parent 3 has\n                        already been shown)\n    -empty-\n"}]}