Handle UTF-8 git paths
ober
8757364f6a946df7ad881ac436732083183d34e7
--- a/README.md +++ b/README.md @@ -75,7 +75,8 @@ used. By default, scans skip `vendor/`, `generated/`, `dist/`, `node_modules/`, and `.git/` paths. Use `--include PATH` or `--file PATH` to inspect one of those paths explicitly. `--include` and `--file` accept repository-relative pathspecs; -absolute paths and `..` components are refused before invoking Git. +absolute paths and `..` components are refused before invoking Git. UTF-8 paths +and paths containing spaces are covered by the fixture tests. Resource limits default to 500 changed files per commit, 20,000 added lines analyzed per commit, and 50,000 bytes per AI note. When a limit is hit, output --- a/main-binary.ss +++ b/main-binary.ss @@ -171,12 +171,12 @@ (def (git repo args) (try - (run-process (append (list "git" "-C" repo "--literal-pathspecs") args)) + (run-process (append (list "git" "-C" repo "-c" "core.quotepath=false" "--literal-pathspecs") args)) (catch (e) ""))) (def (git-ok? repo args) (try (begin - (run-process (append (list "git" "-C" repo "--literal-pathspecs") args)) + (run-process (append (list "git" "-C" repo "-c" "core.quotepath=false" "--literal-pathspecs") args)) #t) (catch (e) #f))) --- a/tests/fixture-smoke.sh +++ b/tests/fixture-smoke.sh @@ -202,12 +202,26 @@ printf '%s\n' "$malformed" | grep -q '"recorded_ai_note_present":true' printf '%s\n' "$malformed" | grep -q '"recorded_attribution":\[\]' printf '%s\n' "$malformed" | grep -q 'refs/notes/ai note is not supported JSON' +mkdir -p "$fixture/unicode path" +unicode_path='unicode path/café helper.py' +printf 'def café_helper(value):\n return value + 1\n' > "$fixture/$unicode_path" +git -C "$fixture" add "$unicode_path" +GIT_AUTHOR_DATE='2026-07-29T09:02:30-06:00' \ +GIT_COMMITTER_DATE='2026-07-29T09:02:30-06:00' \ + git -C "$fixture" commit -q -m 'add unicode path fixture' +unicode_rev=$(git -C "$fixture" rev-parse HEAD) +unicode_json=$("$root/bin/jerboa-aigit" scan "$fixture" --format json --commit "$unicode_rev") +printf '%s\n' "$unicode_json" | grep -q '"files":\["unicode path/café helper.py"\]' +unicode_file_json=$("$root/bin/jerboa-aigit" scan "$fixture" --format json --count 5 --file "$unicode_path") +printf '%s\n' "$unicode_file_json" | grep -q '"count":1' +printf '%s\n' "$unicode_file_json" | grep -q '"files":\["unicode path/café helper.py"\]' + git -C "$fixture" config user.name "Human Dev" git -C "$fixture" config user.email "human@example.test" printf 'vendored update\n' >> "$fixture/vendor/library.py" git -C "$fixture" add vendor/library.py -GIT_AUTHOR_DATE='2026-07-29T09:02:00-06:00' \ -GIT_COMMITTER_DATE='2026-07-29T09:02:00-06:00' \ +GIT_AUTHOR_DATE='2026-07-29T09:03:00-06:00' \ +GIT_COMMITTER_DATE='2026-07-29T09:03:00-06:00' \ git -C "$fixture" commit -q -m 'update vendored library' insufficient=$("$root/bin/jerboa-aigit" scan "$fixture" --format json --count 1) printf '%s\n' "$insufficient" | grep -q '"verdict":"insufficient-evidence"' @@ -215,8 +229,8 @@ printf '%s\n' "$insufficient" | grep -q '"signals":\[\]' printf '%s\n' "$insufficient" | grep -q 'no changed text files found or commit is unavailable' git -C "$fixture" mv README.md README-renamed.md -GIT_AUTHOR_DATE='2026-07-29T09:03:00-06:00' \ -GIT_COMMITTER_DATE='2026-07-29T09:03:00-06:00' \ +GIT_AUTHOR_DATE='2026-07-29T09:04:00-06:00' \ +GIT_COMMITTER_DATE='2026-07-29T09:04:00-06:00' \ git -C "$fixture" commit -q -m 'rename readme' rename_json=$("$root/bin/jerboa-aigit" scan "$fixture" --format json --count 1) printf '%s\n' "$rename_json" | grep -q 'rename/copy changes detected: 1' @@ -226,17 +240,17 @@ git -C "$fixture" checkout -q -b feature-branch mkdir -p "$fixture/branch" printf 'branch work\n' > "$fixture/branch/feature.txt" git -C "$fixture" add branch/feature.txt -GIT_AUTHOR_DATE='2026-07-29T09:04:00-06:00' \ -GIT_COMMITTER_DATE='2026-07-29T09:04:00-06:00' \ +GIT_AUTHOR_DATE='2026-07-29T09:05:00-06:00' \ +GIT_COMMITTER_DATE='2026-07-29T09:05:00-06:00' \ git -C "$fixture" commit -q -m 'feature branch work' git -C "$fixture" checkout -q "$base_branch" printf 'main work\n' > "$fixture/src/human.txt" git -C "$fixture" add src/human.txt -GIT_AUTHOR_DATE='2026-07-29T09:05:00-06:00' \ -GIT_COMMITTER_DATE='2026-07-29T09:05:00-06:00' \ - git -C "$fixture" commit -q -m 'main branch work' GIT_AUTHOR_DATE='2026-07-29T09:06:00-06:00' \ GIT_COMMITTER_DATE='2026-07-29T09:06:00-06:00' \ + git -C "$fixture" commit -q -m 'main branch work' +GIT_AUTHOR_DATE='2026-07-29T09:07:00-06:00' \ +GIT_COMMITTER_DATE='2026-07-29T09:07:00-06:00' \ git -C "$fixture" merge -q --no-ff feature-branch -m 'merge feature branch' merge_rev=$(git -C "$fixture" rev-parse HEAD) merge_json=$("$root/bin/jerboa-aigit" scan "$fixture" --format json --commit "$merge_rev") @@ -249,13 +263,13 @@ printf '%s\n' "$all_parent_json" | grep -q 'src/human.txt' printf '*.bin binary\n' > "$fixture/.gitattributes" git -C "$fixture" add .gitattributes -GIT_AUTHOR_DATE='2026-07-29T09:07:00-06:00' \ -GIT_COMMITTER_DATE='2026-07-29T09:07:00-06:00' \ +GIT_AUTHOR_DATE='2026-07-29T09:08:00-06:00' \ +GIT_COMMITTER_DATE='2026-07-29T09:08:00-06:00' \ git -C "$fixture" commit -q -m 'mark binary assets' printf '\000\001binary\002\n' > "$fixture/model.bin" git -C "$fixture" add model.bin -GIT_AUTHOR_DATE='2026-07-29T09:08:00-06:00' \ -GIT_COMMITTER_DATE='2026-07-29T09:08:00-06:00' \ +GIT_AUTHOR_DATE='2026-07-29T09:09:00-06:00' \ +GIT_COMMITTER_DATE='2026-07-29T09:09:00-06:00' \ git -C "$fixture" commit -q -m 'add binary model asset' binary_rev=$(git -C "$fixture" rev-parse HEAD) binary_json=$("$root/bin/jerboa-aigit" scan "$fixture" --format json --commit "$binary_rev")