FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

TreeEntry#path should return a posix path · Issue #1433 · nodegit/nodegit · GitHub

Repository navigation

TreeEntry#path should return a posix path #1433

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 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.

Here's a sample of what git ls-tree -r HEAD returns on Windows:

100644 blob 3fda23c7b550d75eae3d62e471dd35bbc3d6e667    guides/README.md
100644 blob 7a44d0cf690215933974035542d5af6280294982    guides/cloning/README.md
100644 blob 1a9190ab32758755dc1b964e157d2a44abc512d5    guides/cloning/gh-two-factor/README.md
100644 blob d723e52ccf3569b4b25f25ee5d5f21b7a4138453    guides/cloning/gh-two-factor/index.js
100644 blob f6b7c7a3700b1f29bb40b4a9df01795e3a46f106    guides/cloning/index.js

Here are the paths nodegit returns on Windows when walking the same tree:

guides\README.md
guides\cloning\README.md
guides\cloning\gh-two-factor\README.md
guides\cloning\gh-two-factor\index.js
guides\cloning\index.js

This problem can be easily resolved by using path.posix instead of path in tree_entry.js (and perhaps other places).

If the user really wants the Windows-variant of the path, they can easily get it by passing the value to path.normalize.

Activity

  1. added 2 commits that reference this issue on Jan 26, 2018
    26fbf9f
    47f20d8
  2. mojavelinux commented on Jan 31, 2018

    ContributorAuthor

    PR sent #1434

    Any feedback?

  3. added a commit that references this issue on Mar 19, 2018
    53e2e66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL