-
Notifications
You must be signed in to change notification settings - Fork 65
osfs: Adopt os.Root for path containment, add RootOS, refresh helpers/tests
#211
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
a3a2b6e
build: Add go-git integration test
pjbgf e795131
osfs: Replace filepath-securejoin with os.Root
pjbgf 0fd9efd
osfs: Fix BoundOS capabilities, error handling and abs path logic
pjbgf 6f22d2d
osfs: Improve BoundOS performance and expand benchmarks
pjbgf 2a33d76
osfs: Extract RootOS from BoundOS for caller-managed os.Root
pjbgf d768e0f
build: Remove benchmark from wasm
pjbgf 2d7db04
osfs: Avoid leaking os.Root in RootOS.Chroot
pjbgf c03000b
osfs: Remove unused tempFile and openFile
pjbgf c2029c2
osfs: Normalise path
pjbgf 83fbcf6
osfs: Check for rooted path
pjbgf 50c9641
osfs: Ensure basedir does not need to exist
pjbgf 76b2fb6
osfs: Normalise host path
pjbgf 56ae016
chroot: Improve handling of Windows paths
pjbgf 37a480e
osfs: Improve handling of Windows paths
pjbgf 0bc0ee9
Improve documentation
pjbgf 978e59d
osfs: Fix build for js/wasm
pjbgf 9f7f71c
tests: Add RootOS to comparison benchmarks
pjbgf 4b90a98
Apply go fix ./...
pjbgf 17bae94
Address review feedback on osfs and chroot helper
pjbgf 8bf2791
tests: Skip bench comparison in js/wasm
pjbgf 4cc2e1e
osfs: Remove ChrootOS references
pjbgf ca513f9
osfs: Remove unused WithDeduplicatePath option
pjbgf 64d3e12
osfs: Align capabilities in os_js
pjbgf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| on: | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| name: Go Git Integration | ||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| test: | ||
| name: ${{ matrix.os }} / Go stable | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: | ||
| - ubuntu-latest | ||
| - macos-latest | ||
| - windows-latest | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
| steps: | ||
| - name: Checkout go-billy | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: go-billy | ||
|
|
||
| - name: Select go-git branch | ||
| id: target | ||
| run: | | ||
| set -e | ||
| module_path="$(awk '$1 == "module" { print $2 }' go-billy/go.mod)" | ||
|
|
||
| case "${module_path}" in | ||
| github.com/go-git/go-billy/v6) | ||
| go_git_ref="main" | ||
| ;; | ||
| github.com/go-git/go-billy/v5) | ||
| go_git_ref="releases/v5.x" | ||
| ;; | ||
| *) | ||
| echo "::error::unsupported go-billy module path: ${module_path}" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| echo "go_billy_module=${module_path}" >> "${GITHUB_OUTPUT}" | ||
| echo "go_git_ref=${go_git_ref}" >> "${GITHUB_OUTPUT}" | ||
| echo "Testing ${module_path} against go-git ${go_git_ref}" | ||
|
|
||
| - name: Checkout go-git | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: go-git/go-git | ||
| ref: ${{ steps.target.outputs.go_git_ref }} | ||
| path: go-git | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Install Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: stable | ||
| cache-dependency-path: | | ||
| go-billy/go.sum | ||
| go-git/**/go.sum | ||
|
|
||
| - name: Use local go-billy | ||
| run: | | ||
| set -e | ||
| go_billy_dir="$(cd go-billy && pwd)" | ||
| go_git_dir="$(cd go-git && pwd)" | ||
| go_billy_module="${{ steps.target.outputs.go_billy_module }}" | ||
|
|
||
| if command -v cygpath >/dev/null 2>&1; then | ||
| go_billy="$(cygpath -m "${go_billy_dir}")" | ||
| go_git="$(cygpath -m "${go_git_dir}")" | ||
| else | ||
| go_billy="${go_billy_dir}" | ||
| go_git="${go_git_dir}" | ||
| fi | ||
|
|
||
| cd go-git | ||
| go_git_module="$(awk '$1 == "module" { print $2 }' go.mod)" | ||
| go mod edit -replace "${go_billy_module}=${go_billy}" | ||
| go mod tidy | ||
|
|
||
| if [ -f cli/go-git/go.mod ]; then | ||
| cd cli/go-git | ||
| go mod edit -replace "${go_git_module}=${go_git}" | ||
| go mod edit -replace "${go_billy_module}=${go_billy}" | ||
| go mod tidy | ||
| fi | ||
|
|
||
| - name: Configure known hosts | ||
| continue-on-error: true | ||
| if: matrix.os != 'ubuntu-latest' | ||
| run: | | ||
| mkdir -p ~/.ssh | ||
| ssh-keyscan -H github.com > ~/.ssh/known_hosts | ||
|
|
||
| - name: Set Git config | ||
| run: | | ||
| git config --global user.email "gha@example.com" | ||
| git config --global user.name "GitHub Actions" | ||
|
|
||
| - name: Test go-git | ||
| working-directory: go-git | ||
| run: go test ./... | ||
|
|
||
| - name: Test go-git CLI | ||
| if: ${{ hashFiles('go-git/cli/go-git/go.mod') != '' }} | ||
| working-directory: go-git/cli/go-git | ||
| run: go test ./... | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.