-
Notifications
You must be signed in to change notification settings - Fork 0
docs: remove outdated hash-includes-perms-owner gap #5
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
13 commits
Select commit
Hold shift + click to select a range
8769eae
docs: remove outdated hash-includes-perms-owner gap
nknapp 4375fc7
docs: add plan to close algorithm spec gaps and update gap descriptions
nknapp 2fb816c
feat: close algorithm spec gap — implement steps 4-5 and all missing …
nknapp 410fde1
fix: resolve CI lint and e2e test issues
nknapp 86f8f9d
fix: make deviating dir e2e tests cross-platform
nknapp 0925365
fix: remove unused testDir vars in deviating e2e tests
nknapp 0ae9784
fix: wrap foreign-dir check in bypass and relax source parent existen…
nknapp ea2c65c
refactor: remove permissions field from deviating entries
nknapp 0850497
style: cargo fmt
nknapp f1ebc5c
fix: simplify deviating e2e tests for cross-platform compat
nknapp ad70cb8
fix: address PR review — drop 0o prefix in perms warnings, root:root …
nknapp dcf7944
chore: add bin/git-commit-and-push script and update AGENTS.md
nknapp 66343c3
feat: bin/git-commit-and-push creates PR if none exists
nknapp 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
Some comments aren't visible on the classic Files Changed page.
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
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,153 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
|
|
||
| usage() { | ||
| echo "Usage: $0 <commit-message>" | ||
| echo "" | ||
| echo "Stage all files, run full verification, commit, push, and verify CI." | ||
| echo "" | ||
| echo "Steps:" | ||
| echo " 1. mise run all-local (full verification)" | ||
| echo " 2. git add -A && git commit -m <message>" | ||
| echo " 3. git push origin <current-branch>" | ||
| echo " 4. Create or verify PR" | ||
| echo " 5. Wait for CI to finish" | ||
| echo "" | ||
| echo "Options:" | ||
| echo " --no-verify Skip verification (commit and push only)" | ||
| } | ||
|
|
||
| WORKTREE_ROOT="$(cd "$(dirname "$0")/.." && pwd)" | ||
| BRANCH="$(cd "$WORKTREE_ROOT" && git branch --show-current)" | ||
| PR_NUMBER="" | ||
|
|
||
|
|
||
| detect_ssh_auth() { | ||
| for sock in /run/user/$(id -u)/*ssh* /run/user/$(id -u)/*gcr*ssh* /tmp/ssh-*/*.agent.*; do | ||
| if [ -S "$sock" ] 2>/dev/null; then | ||
| export SSH_AUTH_SOCK="$sock" | ||
| return 0 | ||
| fi | ||
| done | ||
| echo "Warning: no SSH agent socket found. Push may fail." >&2 | ||
| return 1 | ||
| } | ||
|
|
||
|
|
||
| run_verification() { | ||
| echo "--- Running full verification (mise run all-local)..." | ||
| cd "$WORKTREE_ROOT" | ||
| if mise run all-local; then | ||
| echo "--- Verification passed." | ||
| else | ||
| echo "--- Verification FAILED. Aborting." >&2 | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
|
|
||
| commit() { | ||
| local msg="$1" | ||
| cd "$WORKTREE_ROOT" | ||
| git add -A | ||
| git commit -m "$msg" | ||
| } | ||
|
|
||
|
|
||
| push() { | ||
| cd "$WORKTREE_ROOT" | ||
| detect_ssh_auth | ||
| git push origin "$BRANCH" | ||
| } | ||
|
|
||
|
|
||
| ensure_pr() { | ||
| cd "$WORKTREE_ROOT" | ||
| PR_NUMBER=$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number' 2>/dev/null || echo "") | ||
| if [ -z "$PR_NUMBER" ]; then | ||
| echo "No open PR found for branch '$BRANCH'. Creating one..." | ||
| PR_URL=$(gh pr create --fill 2>&1) | ||
| PR_NUMBER=$(echo "$PR_URL" | grep -oE '[0-9]+$' || echo "") | ||
| if [ -z "$PR_NUMBER" ]; then | ||
| echo "Error: Failed to create PR." >&2 | ||
| echo "$PR_URL" >&2 | ||
| return 1 | ||
| fi | ||
| echo "PR #$PR_NUMBER created." | ||
| else | ||
| echo "PR #$PR_NUMBER is still open." | ||
| fi | ||
| } | ||
|
|
||
|
|
||
| wait_for_ci() { | ||
| cd "$WORKTREE_ROOT" | ||
| local run_id | ||
| sleep 5 | ||
| run_id=$(gh run list --branch "$BRANCH" --limit 1 --json databaseId --jq '.[0].databaseId' 2>/dev/null || echo "") | ||
| if [ -z "$run_id" ]; then | ||
| echo "Warning: Could not find CI run for branch '$BRANCH'." >&2 | ||
| return 1 | ||
| fi | ||
| echo "Waiting for CI run #$run_id to complete..." | ||
| gh run watch "$run_id" | ||
| local conclusion | ||
| conclusion=$(gh run view "$run_id" --json conclusion --jq '.conclusion' 2>/dev/null || echo "unknown") | ||
| if [ "$conclusion" != "success" ]; then | ||
| echo "CI failed (conclusion: $conclusion). Inspect with:" >&2 | ||
| echo " gh run view $run_id --log | grep -i error" >&2 | ||
| return 1 | ||
| fi | ||
| echo "All CI jobs passed." | ||
| } | ||
|
|
||
|
|
||
| main() { | ||
| local skip_verify=false | ||
| local msg="" | ||
|
|
||
| while [ $# -gt 0 ]; do | ||
| case "$1" in | ||
| --no-verify) | ||
| skip_verify=true | ||
| shift | ||
| ;; | ||
| --help|-h) | ||
| usage | ||
| exit 0 | ||
| ;; | ||
| *) | ||
| if [ -z "$msg" ]; then | ||
| msg="$1" | ||
| else | ||
| usage | ||
| exit 1 | ||
| fi | ||
| shift | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| if [ -z "$msg" ]; then | ||
| usage | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ "$BRANCH" = "main" ]; then | ||
| echo "Error: You are on 'main' branch. Never commit or push directly to main." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ "$skip_verify" = false ]; then | ||
| run_verification | ||
| fi | ||
|
|
||
| commit "$msg" | ||
| push | ||
| ensure_pr | ||
| wait_for_ci | ||
| } | ||
|
|
||
|
|
||
| main "$@" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import { deindent } from "./lib/index.ts"; | ||
| import { TestBed } from "./lib/TestBed.ts"; | ||
|
|
||
| Deno.test("copy-to-source-permission-check", async (t) => { | ||
| const { testbed } = await TestBed.create(t, { | ||
| configToml: deindent` | ||
| [[sync]] | ||
| source = "./source" | ||
| target = "./target" | ||
| file_perms = "private" | ||
| globs = ["**/*.conf"] | ||
| `, | ||
| files: [ | ||
| "user:user | 0755 | 0 | config.toml | __CONFIG_TOML__", | ||
| "user:user | 0755 | 0 | source/", | ||
| "user:user | 0755 | 0 | target/", | ||
| "user:user | 0644 | 0 | target/file.conf | from target", | ||
| ], | ||
| }); | ||
|
|
||
| await testbed.run({ args: ["--config", "config.toml", "sync"] }); | ||
|
|
||
| testbed.assertOutput({ | ||
| code: 0, | ||
| stdout: deindent` | ||
| source -> target: 0 | ||
| target -> source: 0 | ||
| deleted target: 0 | ||
| deleted source: 0 | ||
| permission skips: 1 | ||
| `, | ||
| stderr: deindent` | ||
| Warning: skipping 'file.conf' (target file has unexpected permissions 644, expected 600 for this preset) | ||
| `, | ||
| }); | ||
| }); | ||
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,27 @@ | ||
| import { assertEquals } from "./lib/index.ts"; | ||
| import { TestBed } from "./lib/TestBed.ts"; | ||
|
|
||
| Deno.test("deviating-directories", async (t) => { | ||
| const { testbed } = await TestBed.create(t, { | ||
| configToml: ` | ||
| [[sync]] | ||
| source = "./source" | ||
| target = "./target" | ||
| globs = ["**/*.conf"] | ||
|
|
||
| [[sync.deviating]] | ||
| path = "./target/special-dir" | ||
| owner = "root:root" | ||
| `, | ||
| files: [ | ||
| "user:user | 0755 | 0 | config.toml | __CONFIG_TOML__", | ||
| "user:user | 0755 | 0 | source/", | ||
| "user:user | 0644 | 0 | source/file.conf | hello", | ||
| "user:user | 0755 | 0 | target/", | ||
| "user:user | 0755 | 0 | target/special-dir/", | ||
| ], | ||
| }); | ||
|
|
||
| await testbed.run({ args: ["--config", "config.toml", "sync"] }); | ||
| assertEquals(testbed.getExitCode(), 0); | ||
| }); |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 755 instead of 0755