Title: Documentation for git_sort_t needs clarification · Issue #2765 · libgit2/libgit2 · GitHub
Open Graph Title: Documentation for git_sort_t needs clarification · Issue #2765 · libgit2/libgit2
X Title: Documentation for git_sort_t needs clarification · Issue #2765 · libgit2/libgit2
Description: Assuming we have this history where commits were created in this numerical order with 1s difference between them: 0---1----2----4----7 (master) \ \ 3----5----6----8--- (topic) Libgit2 commit walker API outputs the following depending on ...
Open Graph Description: Assuming we have this history where commits were created in this numerical order with 1s difference between them: 0---1----2----4----7 (master) \ \ 3----5----6----8--- (topic) Libgit2 commit walker...
X Description: Assuming we have this history where commits were created in this numerical order with 1s difference between them: 0---1----2----4----7 (master) \ \ 3----5----6----8--- (topic) Libgit2 commit walker...
Opengraph URL: https://github.com/libgit2/libgit2/issues/2765
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Documentation for git_sort_t needs clarification","articleBody":"Assuming we have this history where commits were created in this numerical order with 1s difference between them:\n\n```\n 0---1----2----4----7 (master)\n \\ \\\n 3----5----6----8--- (topic)\n```\n\nLibgit2 commit walker API outputs the following depending on the sorting mode:\n- `GIT_SORT_NONE`: 7, 4, 2, 1, 0, 8, 6, 5, 3\n- `GIT_SORT_TIME`: 8, 7, 6, 5, 4, 3, 2, 1, 0\n- `GIT_SORT_TOPOLOGICAL`: 8, 6, 5, 3, 7, 4, 2, 1, 0\n- `GIT_SORT_TOPOLOGICAL | GIT_SORT_TIME`: 7, 8, 6, 4, 2, 5, 3, 1, 0\n\nThe doc for `GIT_SORT_TOPOLOGICAL` however says that parents will come before children which is not the case obviously:\n\n```\n /**\n * Sort the repository contents in topological order\n * (parents before children); this sorting mode\n * can be combined with time sorting.\n */\n GIT_SORT_TOPOLOGICAL = 1 \u003c\u003c 0,\n```\n\nThe doc don't explain either how exactly combining `GIT_SORT_TOPOLOGICAL | GIT_SORT_TIME` works: it just says they can be combined. For instance which mode takes priority over the other? The test above just adds confusion as both `GIT_SORT_TIME` and `GIT_SORT_TOPOLOGICAL` put commit 8 first but combining both modes put commit 7 first.\n\nFor reference, here's how the Git log command help explains the available sorting modes which is easier to understand and less ambiguous IMO:\n\n```\nCommit Ordering\nBy default, the commits are shown in reverse chronological order.\n\n--date-order\nShow no parents before all of its children are shown, but otherwise show commits in the commit timestamp order.\n\n--author-date-order\nShow no parents before all of its children are shown, but otherwise show commits in the author timestamp order.\n\n--topo-order\nShow no parents before all of its children are shown, and avoid showing commits on multiple lines of history intermixed.\n\n--reverse\nOutput the commits in reverse order.\n```\n","author":{"url":"https://github.com/swisspol","@type":"Person","name":"swisspol"},"datePublished":"2014-12-18T18:50:51.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/2765/libgit2/issues/2765"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:74251d0f-23b2-7b25-4169-06e6bbc2d1d2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A1DA:2EAD2D:5117F9E:6CFA545:6A5DD0B1 |
| html-safe-nonce | 8d5e870f91d18c28086f7d6d972756e3b267fab272a75719a7943e2dd5cb4953 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMURBOjJFQUQyRDo1MTE3RjlFOjZDRkE1NDU6NkE1REQwQjEiLCJ2aXNpdG9yX2lkIjoiMTM2OTU3Nzk0NDc3MjM2NjUxMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | fcaef0eb808d543209880d653274f220aafb3e0a98e9fcd66c226e678d4f21b5 |
| hovercard-subject-tag | issue:52401539 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/libgit2/libgit2/2765/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6e0d35bb18ca053bfc806ae832acd6f9a3ec746804d1a444bbd420bb108302a2/libgit2/libgit2/issues/2765 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6e0d35bb18ca053bfc806ae832acd6f9a3ec746804d1a444bbd420bb108302a2/libgit2/libgit2/issues/2765 |
| og:image:alt | Assuming we have this history where commits were created in this numerical order with 1s difference between them: 0---1----2----4----7 (master) \ \ 3----5----6----8--- (topic) Libgit2 commit walker... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | swisspol |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/libgit2/libgit2 git https://github.com/libgit2/libgit2.git |
| octolytics-dimension-user_id | 394745 |
| octolytics-dimension-user_login | libgit2 |
| octolytics-dimension-repository_id | 901662 |
| octolytics-dimension-repository_nwo | libgit2/libgit2 |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 901662 |
| octolytics-dimension-repository_network_root_nwo | libgit2/libgit2 |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width