library: TestPluginUpgradesToNewerTag red on Windows (git tag in '\C:\…\skills.git')
Red on Windows (xiaomi-gpu, Windows 11, Go 1.26.8) at origin/main 6d00d98f8, via win-run go test -count=1 -run 'TestPluginUpgradesToNewerTag' ./internal/library. Windows CI only compiles the tests, so it shows nowhere else.
--- FAIL: TestPluginUpgradesToNewerTag (0.88s)
plugin_tags_test.go:31: git tag v1.0.0: exit status 128
fatal: not a git repository: '\C:\Users\yeton\AppData\Local\Temp\magpie-library-test-2710577928\TestPluginUpgradesToNewerTag2859188680\003\skills.git'
The leading \ before C: suggests the test builds a git path from a URL-style path (/C:/…) and hands it to git as a Windows path. Seen while verifying the artifacts stack on Windows; not caused by it (same red at origin/main).
Fix branch: https://github.com/qq01-hub/magpie/tree/fix/windows-file-url-plugin-tags (52ffe3552)
Compare: https://github.com/yetone/magpie/compare/main...qq01-hub:magpie:fix/windows-file-url-plugin-tags
Root cause:
gitRepo (internal/library/skillgit_test.go:113-117) returns file:///C:/... on Windows. In TestPluginUpgradesToNewerTag (internal/library/plugin_tags_test.go:24), strings.TrimPrefix(addr, "file://") left /C:/..., which filepath.FromSlash converted into \C:\... and git --git-dir rejected with fatal: not a git repository.
Changes:
- Strip the leading
/before a Windows drive prefix (runtime.GOOS == "windows" && len(bare) > 2 && bare[0] == '/' && bare[2] == ':') inTestPluginUpgradesToNewerTag(internal/library/plugin_tags_test.go), matchinginternal/fasttools/session.go:84-86.
Verification (Windows 11 amd64, Go 1.26.8):
- Before fix:
TestPluginUpgradesToNewerTagfailed atplugin_tags_test.go:31withfatal: not a git repository: '\C:\...\skills.git'. - After fix:
go test -count=5 ./internal/library -run 'TestPluginUpgradesToNewerTag|TestRetagSource'passed (10/10);go vet ./internal/librarypassed on Windows, Linux (-tags nogui), and macOS (-tags nogui).
Fixed in v0.1.4845 (b23590f87), @qq01-hub's commit as it was, thanks! TestPluginUpgradesToNewerTag was red on the Windows box at main (\C:\…\skills.git) and is green with it.
Leaving this open until it is confirmed green on a real Windows run.
Reopened: the commit's "Fixes" line closed this on push. It stays open until it's confirmed.
@yetone 佬,这个 issue 的修复分支在 qq01-hub/magpie 上仍是 fix/windows-file-url-plugin-tags(52ffe3552),v0.1.4845 已从它移植;issue 是提交里 Fixes 行自动关又手工 reopen 的,确认没问题就可以关了。