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

Can't Stage a Full Path #23

Closed
cbilson opened this issue May 8, 2011 · 3 comments
Closed

Can't Stage a Full Path #23

cbilson opened this issue May 8, 2011 · 3 comments
Assignees

Comments

@cbilson
Copy link
Contributor

cbilson commented May 8, 2011

I would like to stage a file with a full path. I have a failing test showing this doesn't work (cbilson/libgit2sharp@d849ca7b93538d85cc4a). I thought maybe using the posix helper on the path would fix it (cbilson/libgit2sharp@aae13a51b75d98a20b5c), but it didn't.

Any ideas? Should I just not try to do this? Thanks!

@nulltoken
Copy link
Member

Hey. Thanks for spotting this! As a side note, the index area is far from being achieved. ;-)

Correct me if I'm wrong but when a full path is being passed, I think LibGit2Sharp code should make sure that the caller is not trying to stage a file living outside of the working directory structure.

Two ways to make it happen:

  • Make libgit2 implement this and LibGit2Sharp will wrap it later (In good progress, I think :) )
  • Fake it now within LibGit2Sharp
    • Ensure the rooted passed path leads to a file within the working directory (eg. path.StartsWith(repo.Info.WorkingDirectory) or something similar)
    • Turn the full path into a relative path to the working directory
    • Use the relative path to delegate the staging to libgit2
    • When it's ready in libgit2, we'll just have to remove the boilerplate code

How does this sound?

@ghost ghost assigned nulltoken May 9, 2011
@nulltoken
Copy link
Member

Hey! I think this issue should now be fixed.

Could you please give a try to https://github.com/libgit2/libgit2sharp/commits/vNext ?

@nulltoken
Copy link
Member

Applied and merged into master.

@cbilson: Thanks for the report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants