René's URL Explorer Experiment


Title: "Invalid collation character" when trying to diff · Issue #1097 · nodegit/nodegit · GitHub

Open Graph Title: "Invalid collation character" when trying to diff · Issue #1097 · nodegit/nodegit

X Title: "Invalid collation character" when trying to diff · Issue #1097 · nodegit/nodegit

Description: I'm not 100% sure whether this is a nodegit or a libgit2 issue, so apologies in advanced if this isn't nodegit's fault. When trying to get diffs for certain commits, I'm getting the error "Invalid collation character" returned from nodeg...

Open Graph Description: I'm not 100% sure whether this is a nodegit or a libgit2 issue, so apologies in advanced if this isn't nodegit's fault. When trying to get diffs for certain commits, I'm getting the error "Invalid ...

X Description: I'm not 100% sure whether this is a nodegit or a libgit2 issue, so apologies in advanced if this isn't nodegit's fault. When trying to get diffs for certain commits, I'm getting the...

Opengraph URL: https://github.com/nodegit/nodegit/issues/1097

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"\"Invalid collation character\" when trying to diff","articleBody":"I'm not 100% sure whether this is a nodegit or a libgit2 issue, so apologies in advanced if this isn't nodegit's fault.\n\nWhen trying to get diffs for certain commits, I'm getting the error \"Invalid collation character\" returned from nodegit. However, this isn't for every commit, and it's not for every platform either. I've only been able to get this to happen in this situation:\n- Using nodegit (tested a whole mess of versions, mainly v0.13.2 and v0.15.1)\n- Running under electron (only tested v1.2.3)\n- On Linux (64-bit, haven't tested 32-bit; specifically on the latest releases of Debian and Ubuntu)\n\nIf I'm on any other platform (e.g. just pure nodejs not electron, or Windows or OSX) the problem doesn't happen.\n\nThe easiest way to reproduce the problem is to grab a clone of the sources for git itself: https://github.com/git/git\n\nAnd then run some variation of this script under electron:\n\n``` js\nvar git = require(\"nodegit\");\n\ngit.Repository.open(\"/home/tyler/Desktop/git\")\n    .then(\n        (repo) =\u003e {\n            console.log(\"Repo is open.\");\n\n            return repo.getCommit(\"f5236a776f31de2654bca9001aa74ef9fe0819d8\")\n                .then(\n                    (commit) =\u003e {\n                        return commit.getTree();\n                    }\n                )\n                .then(\n                    (tree) =\u003e {\n                        return git.Diff.treeToWorkdir(repo, tree, new git.DiffOptions());\n                    }\n                )\n            ;\n        }\n    )\n    .then(\n        (diff) =\u003e {\n            console.log(\"Got the diff\");\n\n            return diff.patches()\n                .then(\n                    (patches) =\u003e {\n                        console.log(\"Got the patches.\");\n                        console.log(\"Files changed:\");\n\n                        patches.forEach(\n                            (patch) =\u003e {\n                                let newPath = patch.newFile().path();\n                                let oldPath = patch.oldFile().path();\n                                console.log(newPath, oldPath);\n                            }\n                        );\n                    }\n                )\n            ;\n        }\n    )\n    .then(\n        () =\u003e {\n            console.log(\"Done!\");\n        }\n    )\n    .catch(\n        (error) =\u003e {\n            console.error(\"Some error occurred:\");\n            console.error(error);\n        }\n    )\n;\n```\n\nWhich, instead of logging the files changed in that commit as I would expect, it outputs this instead:\n\n```\nRepo is open.\nGot the diff\nSome error occurred:\nError: Invalid collation character\n    at Error (native)\n```\n\nI'm not terribly familiar with debugging C programs on linux, but I was able to piece together this stack trace:\n\n```\nGitPatch::ConvenientFromDiffWorker::Execute\ngit_patch_from_diff\ndiff_patch_alloc_from_diff\ndiff_patch_init_from_diff\ngit_diff_file_content__init_from_diff\ndiff_file_content_init_common\ngit_diff_driver_lookup\ngit_diff_driver_load\ngit_diff_driver_builtin\nregcomp # The function that actually returns the error.\n```\n\nFor some reason `git_diff_driver_builtin` is using a regex to determine the diff driver to use, and that regex is failing for whatever reason.\n\nEven weirder, it doesn't fail for every commit, but a lot of them. Here are some notes I took while trying to figure this out:\n\n```\nmaster (as of this writing): f8f7adce9fc50a11a764d57815602dcb818d1816\nLast good commit on master (found by using git reset --hard HEAD~1): b48dfd86c90cae3f98dca01101b7e298c0192d16\nFirst bad commit on master: ad2d77760434e1650c186c71fa04a8fdbd77266c\nLast bad commit on master: f5236a776f31de2654bca9001aa74ef9fe0819d8\nFirst good commit before the above bad commit: 566fdaf611f44724120412a43132c07b020fc4f1\nUseful command for going back that far: git reset --hard HEAD~35\n```\n\nReasons why I'm filing a nodegit issue instead of a libgit2 issue:\n- I'm only seeing this under electron, so maybe nodegit is doing something funny when compiled for electron?\n- Perhaps we could patch nodegit so that we can specify the diff driver to use for `diff.patches()`? Otherwise I'm not sure how to work around this.\n\nLet me know if there's any other information I can provide, or generally if anyone has any ideas. I can follow the libgit2 code, but I haven't been able to figure out understand why a regex would be (seemly randomly) failing.\n","author":{"url":"https://github.com/tylerchurch","@type":"Person","name":"tylerchurch"},"datePublished":"2016-08-01T23:30:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":20},"url":"https://github.com/1097/nodegit/issues/1097"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:be9c8ff3-7e9c-4006-f60d-f09f41f13226
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id924A:16A45E:BC69FE:106044B:6970F657
html-safe-nonce2e366a8abfac96124203af6529bb54e2858cd61d505e5c6e71119f7a44907850
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MjRBOjE2QTQ1RTpCQzY5RkU6MTA2MDQ0Qjo2OTcwRjY1NyIsInZpc2l0b3JfaWQiOiI0NTA5NDcwNzU5MjM4ODI1NTU5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac21b57402353059a45e5fe4baaf84490c2a9f2fca06453cbeaf514e70e0d7eb7b
hovercard-subject-tagissue:168765822
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodegit/nodegit/1097/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1d3a5ce8a15dfb86a8745b23e27e80d2a68c9d987f22cb52a487e22acfb7f4c9/nodegit/nodegit/issues/1097
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1d3a5ce8a15dfb86a8745b23e27e80d2a68c9d987f22cb52a487e22acfb7f4c9/nodegit/nodegit/issues/1097
og:image:altI'm not 100% sure whether this is a nodegit or a libgit2 issue, so apologies in advanced if this isn't nodegit's fault. When trying to get diffs for certain commits, I'm getting the error "Invalid ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametylerchurch
hostnamegithub.com
expected-hostnamegithub.com
None1b239ebed690c3053869ff31a3b7597834c25673659d63e7b6fd6a9b5d7853de
turbo-cache-controlno-preview
go-importgithub.com/nodegit/nodegit git https://github.com/nodegit/nodegit.git
octolytics-dimension-user_id657068
octolytics-dimension-user_loginnodegit
octolytics-dimension-repository_id1383170
octolytics-dimension-repository_nwonodegit/nodegit
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1383170
octolytics-dimension-repository_network_root_nwonodegit/nodegit
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseaeacfd55297f3de5395c83f200ac35d1f474115e
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodegit/nodegit/issues/1097#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodegit%2Fnodegit%2Fissues%2F1097
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodegit%2Fnodegit%2Fissues%2F1097
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodegit%2Fnodegit
Reloadhttps://github.com/nodegit/nodegit/issues/1097
Reloadhttps://github.com/nodegit/nodegit/issues/1097
Reloadhttps://github.com/nodegit/nodegit/issues/1097
nodegit https://github.com/nodegit
nodegithttps://github.com/nodegit/nodegit
Notifications https://github.com/login?return_to=%2Fnodegit%2Fnodegit
Fork 697 https://github.com/login?return_to=%2Fnodegit%2Fnodegit
Star 5.8k https://github.com/login?return_to=%2Fnodegit%2Fnodegit
Code https://github.com/nodegit/nodegit
Issues 343 https://github.com/nodegit/nodegit/issues
Pull requests 19 https://github.com/nodegit/nodegit/pulls
Actions https://github.com/nodegit/nodegit/actions
Projects 0 https://github.com/nodegit/nodegit/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/nodegit/nodegit/security
Please reload this pagehttps://github.com/nodegit/nodegit/issues/1097
Insights https://github.com/nodegit/nodegit/pulse
Code https://github.com/nodegit/nodegit
Issues https://github.com/nodegit/nodegit/issues
Pull requests https://github.com/nodegit/nodegit/pulls
Actions https://github.com/nodegit/nodegit/actions
Projects https://github.com/nodegit/nodegit/projects
Security https://github.com/nodegit/nodegit/security
Insights https://github.com/nodegit/nodegit/pulse
New issuehttps://github.com/login?return_to=https://github.com/nodegit/nodegit/issues/1097
New issuehttps://github.com/login?return_to=https://github.com/nodegit/nodegit/issues/1097
"Invalid collation character" when trying to diffhttps://github.com/nodegit/nodegit/issues/1097#top
https://github.com/tylerchurch
https://github.com/tylerchurch
tylerchurchhttps://github.com/tylerchurch
on Aug 1, 2016https://github.com/nodegit/nodegit/issues/1097#issue-168765822
https://github.com/git/githttps://github.com/git/git
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.