Title: NodeGit does not expose a proper API for displaying large binary diffs · Issue #1369 · nodegit/nodegit · GitHub
Open Graph Title: NodeGit does not expose a proper API for displaying large binary diffs · Issue #1369 · nodegit/nodegit
X Title: NodeGit does not expose a proper API for displaying large binary diffs · Issue #1369 · nodegit/nodegit
Description: The diff process in libgit2 automatically assumes that files over ~536MB are binary files. This causes the diff process to assign a GIT_DIFF_FLAG_BINARY to the file (see here). When the GIT_DIFF_FLAG_BINARY flag is set on a file it will ...
Open Graph Description: The diff process in libgit2 automatically assumes that files over ~536MB are binary files. This causes the diff process to assign a GIT_DIFF_FLAG_BINARY to the file (see here). When the GIT_DIFF_FL...
X Description: The diff process in libgit2 automatically assumes that files over ~536MB are binary files. This causes the diff process to assign a GIT_DIFF_FLAG_BINARY to the file (see here). When the GIT_DIFF_FL...
Opengraph URL: https://github.com/nodegit/nodegit/issues/1369
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"NodeGit does not expose a proper API for displaying large binary diffs","articleBody":"The diff process in libgit2 automatically assumes that files over ~536MB are binary files. This causes the diff process to assign a `GIT_DIFF_FLAG_BINARY` to the file ([see here](https://github.com/libgit2/libgit2/blob/master/src/diff_file.c#L23)). When the `GIT_DIFF_FLAG_BINARY` flag is set on a file it will eventually set that flag on the delta too causing the diff process to avoid generating hunks for the patches on the diff. Instead, it generates a [binary](https://github.com/libgit2/libgit2/blob/master/src/patch_generate.c#L256) object on any patch (I assume there is only one at this point, I have not seen otherwise).\r\n\r\nThe binary object is not exposed properly via the `ConvenientPatch` object in NodeGit. It should be so we can then expose the content of the binary object. Normally, this would probably not be an issue, but if we filter the binary content--say with Git LFS--we cannot see any diff output for files over the max file size threshold. \r\n\r\n[Here is where the binary object will be generated instead of hunks](https://github.com/libgit2/libgit2/blob/master/src/patch_generate.c#L383) as any delta with the `GIT_DIFF_FLAG_BINARY` flag calls the binary callback instead of the diff callback and never emits the diff.\r\n\r\nAnother potential issue is [deflating](https://github.com/libgit2/libgit2/blob/master/src/patch_generate.c#L274) the filtered content on the binary object. It appears that libgit2 deflates the content regardless of what it is, so this could mean that even if we expose the binary object we won't be able to actually see the filtered content. This may not be an issue, I guess we will need to see that the final content of the binary object is after it has been exposed.\r\n\r\n@implausible, if you could look into this that would be amazing. If not I will look into it in a couple weeks.","author":{"url":"https://github.com/cjhoward92","@type":"Person","name":"cjhoward92"},"datePublished":"2017-09-07T22:58:49.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1369/nodegit/issues/1369"}
| 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:2ecfe807-234e-ab4c-97fa-68382687e261 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D1D2:1F2E21:DA469:11F104:6A5FE709 |
| html-safe-nonce | 3c71b3f7cc02e6123197c35cc1e6731eff3f32913f2f86e199844f3e4ab0a4cc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMUQyOjFGMkUyMTpEQTQ2OToxMUYxMDQ6NkE1RkU3MDkiLCJ2aXNpdG9yX2lkIjoiNzQyMzkxNzIyNzA4NjE3ODA1NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 343570528f6e58a8a7533283fb177f6d162f25fcd3ece19bf194334cf88d52fa |
| hovercard-subject-tag | issue:256094282 |
| 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/1369/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5e5b46e0709c4ea898770256a8f8fa7151a1f0fbd655b8fc4fff7e3d47b70557/nodegit/nodegit/issues/1369 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5e5b46e0709c4ea898770256a8f8fa7151a1f0fbd655b8fc4fff7e3d47b70557/nodegit/nodegit/issues/1369 |
| og:image:alt | The diff process in libgit2 automatically assumes that files over ~536MB are binary files. This causes the diff process to assign a GIT_DIFF_FLAG_BINARY to the file (see here). When the GIT_DIFF_FL... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cjhoward92 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 78938542173c0d8e4ad1aefc7954896e81c10ce2620286603ef14cf593bd5a11 |
| 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 | 1a427601e09953033b696253e754ebc7328096a7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width