Skip to content

Enable Git long paths for clone and fetch - #19

Merged
andrew merged 1 commit into
mainfrom
fix/windows-longpaths
Sep 4, 2026
Merged

andrew merged 1 commit into
mainfrom
fix/windows-longpaths

Conversation

@andrew

@andrew andrew commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Pass -c core.longpaths=true to clone and fetch commands so Git for Windows can write paths past MAX_PATH without requiring global configuration. Apply the same override when unshallowing cached repositories.

Closes #18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change is small, localized to Git argument construction, and includes focused tests covering the new behavior paths.

Pull request overview

This PR addresses Windows MAX_PATH failures during repository operations by injecting a per-invocation Git config override (-c core.longpaths=true) into clone/fetch-related commands, including the cached-repo unshallow path, avoiding the need for global Git configuration.

Changes:

  • Introduce a longPathArgs helper to prefix Git invocations with -c core.longpaths=true.
  • Apply the override to Ensure’s clone and fetch flows.
  • Apply the override to cached repository unshallow fetch, and add targeted tests asserting the argument prefix.
File summaries
File Description
run.go Adds longPathArgs helper to prefix Git argv with the long-path config override.
ensure.go Uses longPathArgs(...) for clone and fetch invocations in Ensure.
ensure_test.go Adds a test verifying clone/fetch commands are invoked with the long-path config prefix.
cache.go Uses longPathArgs(...) for the cached unshallow fetch invocation.
cache_test.go Adds a test verifying the unshallow fetch command is invoked with the long-path config prefix.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@andrew
andrew merged commit 80aa6e8 into main Sep 4, 2026
3 checks passed
@andrew
andrew deleted the fix/windows-longpaths branch September 4, 2026 12:24
@andrew

andrew commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

updateSubmodules at ensure.go:106,115 (submodule sync --recursive and submodule update --init --recursive --depth 1) does not go through longPathArgs, so a submodule whose .git/objects/pack path exceeds 260 still fails. Hit this after bumping scrutineer to 67c4b52: the top-level clone now works but the submodule step does not.

Separately, Submodules() on Windows reports checked out commit X does not match gitlink Y for a fixture that works on Linux/macOS (same run, https://github.com/alpha-omega-security/scrutineer/actions/runs/33872943042), which looks unrelated to longpaths.

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.

Set core.longpaths on Windows

2 participants