Title: TreeEntry#path should return a posix path · Issue #1433 · nodegit/nodegit · GitHub
Open Graph Title: TreeEntry#path should return a posix path · Issue #1433 · nodegit/nodegit
X Title: TreeEntry#path should return a posix path · Issue #1433 · nodegit/nodegit
Description: When I use git ls-tree, regardless of whether I'm on Linux, macOS, or Windows, it always reports posix paths (paths that use forward slash as the directory separator). This makes sense since git is a database of virtual paths which have ...
Open Graph Description: When I use git ls-tree, regardless of whether I'm on Linux, macOS, or Windows, it always reports posix paths (paths that use forward slash as the directory separator). This makes sense since git is...
X Description: When I use git ls-tree, regardless of whether I'm on Linux, macOS, or Windows, it always reports posix paths (paths that use forward slash as the directory separator). This makes sense since gi...
Opengraph URL: https://github.com/nodegit/nodegit/issues/1433
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TreeEntry#path should return a posix path","articleBody":"When I use `git ls-tree`, regardless of whether I'm on Linux, macOS, or Windows, it always reports posix paths (paths that use forward slash as the directory separator). This makes sense since git is a database of virtual paths which have nothing to do with the filesystem / platform I'm currently on. nodegit, on the other hand, returns platform-specific paths. In other words, on Windows, the TreeEntry#path returns a different value than on Linux. It's even stranger that I request an entry using a posix path, but I get back a platform-specific path.\r\n\r\nHere's a sample of what `git ls-tree -r HEAD` returns on Windows:\r\n\r\n```\r\n100644 blob 3fda23c7b550d75eae3d62e471dd35bbc3d6e667 guides/README.md\r\n100644 blob 7a44d0cf690215933974035542d5af6280294982 guides/cloning/README.md\r\n100644 blob 1a9190ab32758755dc1b964e157d2a44abc512d5 guides/cloning/gh-two-factor/README.md\r\n100644 blob d723e52ccf3569b4b25f25ee5d5f21b7a4138453 guides/cloning/gh-two-factor/index.js\r\n100644 blob f6b7c7a3700b1f29bb40b4a9df01795e3a46f106 guides/cloning/index.js\r\n```\r\n\r\nHere are the paths nodegit returns on Windows when walking the same tree:\r\n\r\n```\r\nguides\\README.md\r\nguides\\cloning\\README.md\r\nguides\\cloning\\gh-two-factor\\README.md\r\nguides\\cloning\\gh-two-factor\\index.js\r\nguides\\cloning\\index.js\r\n```\r\n\r\nThis problem can be easily resolved by using [path.posix](https://nodejs.org/api/path.html#path_path_posix) instead of path in tree_entry.js (and perhaps other places).\r\n\r\nIf the user really wants the Windows-variant of the path, they can easily get it by passing the value to `path.normalize`.","author":{"url":"https://github.com/mojavelinux","@type":"Person","name":"mojavelinux"},"datePublished":"2018-01-26T05:39:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1433/nodegit/issues/1433"}
| 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:958aa2b2-f4a5-e98b-8927-21e86791f362 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DA68:2036CD:1D306A:27953E:6A5FEB45 |
| html-safe-nonce | 8024516b5655d2ca60598a0ae7fdc812fb871f2d0b2675c0400ec6f29cac2192 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTY4OjIwMzZDRDoxRDMwNkE6Mjc5NTNFOjZBNUZFQjQ1IiwidmlzaXRvcl9pZCI6IjM3NjkzNjU1NjgyMjA1NTYxMDEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9110f8aa3e22dae9dbaa7439ec9a4057b6e9834ef4244f4bd5c56fb374e80023 |
| hovercard-subject-tag | issue:291804708 |
| 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/1433/issue_layout |
| twitter:image | https://opengraph.githubassets.com/68dc80535d919be9929565fa1bad15be297afb4d1026c2cd2d0a09b3b65fca1d/nodegit/nodegit/issues/1433 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/68dc80535d919be9929565fa1bad15be297afb4d1026c2cd2d0a09b3b65fca1d/nodegit/nodegit/issues/1433 |
| og:image:alt | When I use git ls-tree, regardless of whether I'm on Linux, macOS, or Windows, it always reports posix paths (paths that use forward slash as the directory separator). This makes sense since git is... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mojavelinux |
| hostname | github.com |
| expected-hostname | github.com |
| None | ba296ecd3a3521238fe43b3b3b08cc09207ddc21173e16ee656db03803de8e2b |
| 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 | 6e50fb37e29e4aa0df6386cb485e58b0e3ca97ab |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width