go-git / go-billy

The missing interface filesystem abstraction for Go
https://pkg.go.dev/github.com/go-git/go-billy/v5
Apache License 2.0
324 stars 43 forks source link

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

Closed rminnich closed 7 months ago

rminnich commented 7 months ago

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 commented 7 months ago

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.

pjbgf commented 7 months ago

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.

pjbgf commented 7 months ago

Thank you @rminnich! :bow:

rminnich commented 6 months ago

Fixes #42