Title: fileHistoryWalk does not return all commits · Issue #1068 · nodegit/nodegit · GitHub
Open Graph Title: fileHistoryWalk does not return all commits · Issue #1068 · nodegit/nodegit
X Title: fileHistoryWalk does not return all commits · Issue #1068 · nodegit/nodegit
Description: When I compare the history returned by fileHistoryWalk to git log console output, there are a lot of commits missing from the fileHistoryWalk commits. For example, using the atom editor repo and source: cd /tmp git clone https://github.c...
Open Graph Description: When I compare the history returned by fileHistoryWalk to git log console output, there are a lot of commits missing from the fileHistoryWalk commits. For example, using the atom editor repo and so...
X Description: When I compare the history returned by fileHistoryWalk to git log console output, there are a lot of commits missing from the fileHistoryWalk commits. For example, using the atom editor repo and so...
Opengraph URL: https://github.com/nodegit/nodegit/issues/1068
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"fileHistoryWalk does not return all commits","articleBody":"When I compare the history returned by fileHistoryWalk to git log console output, there are a lot of commits missing from the fileHistoryWalk commits.\n\nFor example, using the atom editor repo and source:\n\n``` bash\ncd /tmp\ngit clone https://github.com/atom/atom.git\ncd atom\ngit log src/text-editor.coffee\n```\n\n...then, using a slightly modified examples/walk-history-for-file.js (see below) and compare. The output from the example says there are 129 commits to text-editor.coffee but git log src/text-editor.coffee shows 481 commits to that file.\n\nmodified example (changed repo, test tile path and added count output:\n\n``` javascript\nvar nodegit = require(\"../\"),\n path = require(\"path\"),\n historyFile = \"src/text-editor.coffee\",\n walker,\n historyCommits = [],\n commit,\n repo;\n\n// This code walks the history of the master branch and prints results\n// that look very similar to calling `git log` from the command line\n\nfunction compileHistory(resultingArrayOfCommits) {\n var lastSha;\n if (historyCommits.length \u003e 0) {\n lastSha = historyCommits[historyCommits.length - 1].commit.sha();\n if (\n resultingArrayOfCommits.length == 1 \u0026\u0026\n resultingArrayOfCommits[0].commit.sha() == lastSha\n ) {\n return;\n }\n }\n\n resultingArrayOfCommits.forEach(function(entry) {\n historyCommits.push(entry);\n });\n\n lastSha = historyCommits[historyCommits.length - 1].commit.sha();\n\n walker = repo.createRevWalk();\n walker.push(lastSha);\n walker.sorting(nodegit.Revwalk.SORT.TIME);\n\n return walker.fileHistoryWalk(historyFile, 500)\n .then(compileHistory);\n}\n\n//nodegit.Repository.open(path.resolve(__dirname, \"../.git\"))\nnodegit.Repository.open(\"/tmp/atom/.git\")\n .then(function(r) {\n repo = r;\n return repo.getMasterCommit();\n })\n .then(function(firstCommitOnMaster){\n // History returns an event.\n walker = repo.createRevWalk();\n walker.push(firstCommitOnMaster.sha());\n walker.sorting(nodegit.Revwalk.SORT.Time);\n\n return walker.fileHistoryWalk(historyFile, 500);\n })\n .then(compileHistory)\n .then(function() {\n historyCommits.forEach(function(entry) {\n commit = entry.commit;\n console.log(\"commit \" + commit.sha());\n console.log(\"Author:\", commit.author().name() +\n \" \u003c\" + commit.author().email() + \"\u003e\");\n console.log(\"Date:\", commit.date());\n console.log(\"\\n \" + commit.message());\n });\n console.log(\"\\n\\n\" + historyCommits.length + \" total commits\");\n })\n .done();\n\n```\n","author":{"url":"https://github.com/littlebee","@type":"Person","name":"littlebee"},"datePublished":"2016-07-11T01:19:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":15},"url":"https://github.com/1068/nodegit/issues/1068"}
| 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:1e9c7a3b-2c1b-12f4-558d-3cff29077fe3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8870:3DC8AB:408B1CD:573D2E4:69708BF4 |
| html-safe-nonce | f56557595718aa4b39a70dc6d2d8f79a6d4067f6ba3a9123d76c11058f733220 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODcwOjNEQzhBQjo0MDhCMUNEOjU3M0QyRTQ6Njk3MDhCRjQiLCJ2aXNpdG9yX2lkIjoiNjU0MTU0OTAxMzk1MjQwMDM3MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 082f5a91358d582d148ee5cfa60f61160c6e12051cb761a6a62421b649c3df1b |
| hovercard-subject-tag | issue:164744560 |
| 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/nodegit/nodegit/1068/issue_layout |
| twitter:image | https://opengraph.githubassets.com/41f3581daeee29367e0a6471c56f9ca4b24ece64f16786f1dd169dc880280568/nodegit/nodegit/issues/1068 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/41f3581daeee29367e0a6471c56f9ca4b24ece64f16786f1dd169dc880280568/nodegit/nodegit/issues/1068 |
| og:image:alt | When I compare the history returned by fileHistoryWalk to git log console output, there are a lot of commits missing from the fileHistoryWalk commits. For example, using the atom editor repo and so... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | littlebee |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodegit/nodegit git https://github.com/nodegit/nodegit.git |
| octolytics-dimension-user_id | 657068 |
| octolytics-dimension-user_login | nodegit |
| octolytics-dimension-repository_id | 1383170 |
| octolytics-dimension-repository_nwo | nodegit/nodegit |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1383170 |
| octolytics-dimension-repository_network_root_nwo | nodegit/nodegit |
| 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 | 7d6181066430cc06553c8396ca201e194ae33cb9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width