Title: Commit.getDiff is backwards? · Issue #368 · nodegit/nodegit · GitHub
Open Graph Title: Commit.getDiff is backwards? · Issue #368 · nodegit/nodegit
X Title: Commit.getDiff is backwards? · Issue #368 · nodegit/nodegit
Description: Using commit.getDiff in a recent project, and the diff I'm getting appears to be the reverse of what is expected. It would seem that this line... return thisTree.diff(parentTree); should in fact be return parentTree(thisTree); Mostly bec...
Open Graph Description: Using commit.getDiff in a recent project, and the diff I'm getting appears to be the reverse of what is expected. It would seem that this line... return thisTree.diff(parentTree); should in fact be...
X Description: Using commit.getDiff in a recent project, and the diff I'm getting appears to be the reverse of what is expected. It would seem that this line... return thisTree.diff(parentTree); should in fac...
Opengraph URL: https://github.com/nodegit/nodegit/issues/368
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Commit.getDiff is backwards?","articleBody":"Using commit.getDiff in a recent project, and the diff I'm getting appears to be the reverse of what is expected. It would seem that [this line](https://github.com/nodegit/nodegit/blob/master/lib/commit.js#L176)...\n\n``` js\nreturn thisTree.diff(parentTree);\n```\n\nshould in fact be \n\n``` js\nreturn parentTree(thisTree);\n```\n\nMostly because, in my expectation, getDiff would give me the changes made in that commit from the previous, **not** the changes required to undo the commit. \n\nBasically, I believe the current method is performing something like\n\n``` bash\ngit diff sha..parent\n```\n\nwhen I would expect\n\n``` bash\ngit diff parent..sha\n```\n\nAm I reading this right, or am I just going crazy? If I'm right, I can put in a PR to fix, I just wanted to make sure I'm understanding before I put in the change.\n","author":{"url":"https://github.com/orderedlist","@type":"Person","name":"orderedlist"},"datePublished":"2015-01-26T22:00:33.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/368/nodegit/issues/368"}
| 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:16213c07-8a11-da2e-2362-d8a9b6c3c9a0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E368:A77A2:56001F:718067:6A5FCD16 |
| html-safe-nonce | 5cc759f431f55262886c35467e65762f2a4bb1e2b709472e8ccb811abf3ebbc3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzY4OkE3N0EyOjU2MDAxRjo3MTgwNjc6NkE1RkNEMTYiLCJ2aXNpdG9yX2lkIjoiOTA2Nzc0NDk5NzA2MjYwNzU4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 960c3c5e94adfe9345e8101f46467feb89aa926c7d0cc5c4a0ea8a06f554951f |
| hovercard-subject-tag | issue:55543922 |
| 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/368/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4a3e63463261fd20792877bfb7112f42294dd51e0b0e541212d445c3cd17eae5/nodegit/nodegit/issues/368 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4a3e63463261fd20792877bfb7112f42294dd51e0b0e541212d445c3cd17eae5/nodegit/nodegit/issues/368 |
| og:image:alt | Using commit.getDiff in a recent project, and the diff I'm getting appears to be the reverse of what is expected. It would seem that this line... return thisTree.diff(parentTree); should in fact be... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | orderedlist |
| hostname | github.com |
| expected-hostname | github.com |
| None | 53a28a7799cbf673993ab89fc44869fea4c4a6545a861a4d1445e83e8d03aabd |
| 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 | dc08399f879d576f0edbb8c52a0a1a30d498b203 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width