Skip to content

Fix Windows tool-managed entries in repository dirty check#202

Open
DannySotzny wants to merge 5 commits intoversionize:mainfrom
DannySotzny:Ignore_SymLink_On_Windows
Open

Fix Windows tool-managed entries in repository dirty check#202
DannySotzny wants to merge 5 commits intoversionize:mainfrom
DannySotzny:Ignore_SymLink_On_Windows

Conversation

@DannySotzny
Copy link
Copy Markdown
Contributor

Fix Windows tool-managed entries in repository dirty check

Summary

This PR updates the repository dirty-state validation to better handle Windows-specific tool-managed files inside agent directories such as .claude, .agent, .agents, .cursor, .winsurf, .windsurf, .opencode, and .codex.

With the growing use of AI skills, local tooling may install shared skill content into these directories. Tools such as skills from skills.sh can create symlinks instead of duplicating files. On Windows, LibGit2Sharp may report these entries as dirty even though they are tool-managed and should not block versionize. The validator now ignores:

  • real Windows symlinks inside the supported tool directories
  • DeletedFromWorkdir entries in those directories when the file still exists on disk

The command still warns the user when such entries are detected and continues to fail for actual dirty files outside the supported cases.

Motivation

versionize could incorrectly stop before execution on Windows when AI skill tooling installed shared files into agent directories using symlinks or similar file-system behavior. In practice, this forced users to fall back to --skip-dirty, even though bypassing the dirty check should not be the default path for normal usage.

In real repositories, Git CLI could report a clean working tree while LibGit2Sharp still surfaced false-positive dirty entries for those tool-managed paths. This change aligns validation with that real-world scenario without weakening normal dirty-repository protection.

Changes

  • added warning output support to the command-line UI
  • extended repo state validation with Windows-specific filtering for supported tool directories
  • added warning messages for ignored symlinks and existing-on-disk deleted entries
  • added focused validator tests for:
    • supported tool-directory symlinks
    • mixed ignored entries plus real dirty files
    • unsupported directories remaining dirty
    • silent output behavior
    • real Windows symlink detection using a testSymLink folder
    • DeletedFromWorkdir entries that still exist on disk

Testing

  • dotnet test Versionize.Tests/Versionize.Tests.csproj
  • dotnet "D:\git\versionize\Versionize\bin\Debug\net10.0\Versionize.dll" --workingDir "D:\git\#wgtApp\WgtApp.Management" --dry-run

Notes

  • The dry run now succeeds for the tested Windows repository and reports ignored tool-managed entries as warnings instead of blocking execution.
  • Normal dirty-file handling remains unchanged for non-tool paths and real repository changes.

@DannySotzny DannySotzny marked this pull request as ready for review March 22, 2026 18:56
Copilot AI review requested due to automatic review settings March 22, 2026 18:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates versionize’s repository dirty-state validation to avoid Windows-specific false positives caused by tool-managed (AI/agent) directories, while warning users about ignored entries.

Changes:

  • Extend dirty-check logic to ignore specific Windows reparse-point (symlink/junction) entries and certain DeletedFromWorkdir tool-directory entries that still exist on disk.
  • Add a CommandLineUI.Warning() output path and new warning message templates.
  • Add Windows-focused validator tests covering allowed/blocked cases and silent output behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
Versionize/Git/RepoStateValidator.cs Adds Windows-only filtering/ignoring rules for tool-managed directories and warning emission for ignored entries.
Versionize/CommandLine/InfoMessages.cs Introduces user-facing warning message templates for ignored tool symlinks and tool-directory entries.
Versionize/CommandLine/CommandLineUI.cs Adds a new Warning() method for emitting warning-colored output based on verbosity.
Versionize.Tests/Git/RepoStateValidatorTests.cs Adds test coverage for Windows symlink handling, mixed dirty states, and silent output behavior.

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.

2 participants