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

boundos:insideBaseDirEval: return true if baseDir is "/" #48

Merged
merged 1 commit into from
Apr 28, 2024

Conversation

rminnich
Copy link
Contributor

insideBaseDirEval would fail if baseDir was "/".
Since "/" contains anything, and can never be a symlink, just return true, nil if baseDir is "/".

Add a simple test for this case.

Also, while we are at it, have the returned error be a lot more informative: show the name and the base diectory; further, have it wrap os.ErrNotExist should anyone wish to use errors.Is at some point.

@rminnich
Copy link
Contributor Author

I'll fix these tests, they really should be updated to use errors.Is.

need to see how to do that in the context of this test framework.

Copy link
Member

@pjbgf pjbgf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small nit, otherwise LGTM.

osfs/os_bound.go Outdated Show resolved Hide resolved
@pjbgf
Copy link
Member

pjbgf commented Apr 19, 2024

I'll fix these tests, they really should be updated to use errors.Is.

@rminnich Feel free to add a commit to that effect or do a follow-up PR.

insideBaseDirEval would fail if baseDir was "/".
Since "/" contains anything, and can never be a symlink,
just return true, nil if baseDir is "/".

Add a simple test for this case.

Also, while we are at it, have the returned error be a lot more
informative: show the name and the base diectory; further, have it
wrap os.ErrNotExist should anyone wish to use errors.Is at some
point.

Signed-off-by: Ronald G Minnich <rminnich@gmail.com>
@pjbgf pjbgf merged commit b7d9906 into go-git:master Apr 28, 2024
15 checks passed
@pjbgf
Copy link
Member

pjbgf commented Apr 28, 2024

Thank you @rminnich! 🙇

@rminnich
Copy link
Contributor Author

Fixes #42

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

Successfully merging this pull request may close these issues.

2 participants