Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libgit2 path issues #18724

Open
pfitzseb opened this issue Sep 29, 2016 · 3 comments
Open

libgit2 path issues #18724

pfitzseb opened this issue Sep 29, 2016 · 3 comments
Labels
libgit2 The libgit2 library or the LibGit2 stdlib module

Comments

@pfitzseb
Copy link
Member

There are a couple of issues with the current implementation (or the docs) of LibGit2:
Functions like LibGit2.add! take a files argument, which must be (as per here)

  • relative to the repos cwd and
  • separated by forward slashes.

Since there are no docs for the functions libgit2/index.jl that's a bit of a usability problem which e.g. caused PkgDev.tag to not work on Windows (see JuliaLang/PkgDev.jl#28).

I'd suggest to either

  • normalize paths to use forward slashes,
  • either error when an absolute path is input or try to resolve it to a path relative to the repos cwd (which should mostly be it's root),
  • document the above, and
  • test those cases.

or

  • document that the path passed to those functions needs to conform to the conditions above and
  • throw an error if they don't (instead of silently failing to do anything), and
  • test those cases.

I can look into preparing a PR for either of the above if someone decides what to do, but maybe someone more familiar with the codebase would be better suited to do that.

cc @tkelman

@tkelman tkelman added the libgit2 The libgit2 library or the LibGit2 stdlib module label Sep 29, 2016
@tkelman
Copy link
Contributor

tkelman commented Sep 29, 2016

We should attempt to identify which of these limitations come from the c library and which are self inflicted bugs. Command line git lets you use abs paths but errors if you try to add something that's not inaide the current repo, right?

@pfitzseb
Copy link
Member Author

See here and here: libgit2 only allows you to use forward slashes in functions that take git paths (as opposed to filesystem paths), so it's mostly a limitation (or decision, rather) with the c library. I'd argue we should be working around that though.

@tkelman
Copy link
Contributor

tkelman commented Sep 29, 2016

Good find. I agree with you and think we should try to do some obvious manipulations before sending to the c library in the bindings instead of needing every user to test and work around the same issues (or all hit this problem if they don't)

@pfitzseb pfitzseb mentioned this issue Jan 8, 2017
42 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libgit2 The libgit2 library or the LibGit2 stdlib module
Projects
None yet
Development

No branches or pull requests

2 participants