Summary
mizchi/bit_remote 0.48.0 resolves an absolute Windows gitdir: target as a relative path. For example:
.git path: C:/linked/.git
- Contents:
gitdir: C:/repo/.git/worktrees/linked
- Expected:
C:/repo/.git/worktrees/linked
- Actual:
C:/linked/C:/repo/.git/worktrees/linked
The published package reproduces this deterministically. Current main at 2681c3bc815d01aa56e678f45eb98e268c052481 still checks only whether the target starts with /.
Minimal reproduction
This test injects Windows-style .git contents through the public RepoFileSystem trait, so it runs without a Windows host or any actual repository. Create these files and run moon test --target native.
moon.mod
name = "repro/bit-gitdir"
version = "0.0.0"
import {
"mizchi/bit_remote@0.48.0",
"mizchi/bit_types@0.48.0",
}
moon.pkg
import {
"mizchi/bit_remote" @remote,
"mizchi/bit_types" @types,
"moonbitlang/core/encoding/utf8",
} for "wbtest"
repro_wbtest.mbt
///|
priv struct GitdirFixture { target : String }
///|
impl @types.RepoFileSystem for GitdirFixture with fn read_file(self, _) {
@utf8.encode("gitdir: " + self.target + "\n")
}
///|
impl @types.RepoFileSystem for GitdirFixture with fn readdir(_, _) { [] }
///|
impl @types.RepoFileSystem for GitdirFixture with fn is_dir(_, _) { false }
///|
impl @types.RepoFileSystem for GitdirFixture with fn is_file(_, _) { true }
///|
impl @types.RepoFileSystem for GitdirFixture with fn mtime(_, _) { (0, 0) }
///|
test "absolute Windows gitdir" {
let target = "C:/repo/.git/worktrees/linked"
let fs = GitdirFixture::{ target }
assert_eq(@remote.resolve_gitdir(fs, "C:/linked/.git"), target)
}
Actual assertion failure:
"C:/linked/C:/repo/.git/worktrees/linked" != "C:/repo/.git/worktrees/linked"
Cause and suggested coverage
resolve_gitdir treats every target not starting with / as relative and prepends the .git file's parent. detect_git_dir uses that result, so library callers can receive an invalid metadata directory for a Windows linked worktree.
Please use platform-aware absolute-path and parent-path handling. Regression coverage should include Windows drive-rooted paths, native-backslash/UNC forms, existing POSIX absolute paths, and ordinary relative gitdir: paths. Drive-relative paths such as C:relative should remain distinct from C:/absolute.
Verification scope
- Executed the injected-filesystem reproduction on macOS against
mizchi/bit_remote@0.48.0 and mizchi/bit_types@0.48.0.
- Confirmed the unchanged resolver in current upstream source.
- I have not run a real linked-worktree integration test on Windows. The Windows end-to-end impact is inferred from the reproduced path-resolution result.
- Toolchain:
moon 0.1.20260920 (914d7da), moonc v0.10.14+7d59c7ec9.
Summary
mizchi/bit_remote0.48.0 resolves an absolute Windowsgitdir:target as a relative path. For example:.gitpath:C:/linked/.gitgitdir: C:/repo/.git/worktrees/linkedC:/repo/.git/worktrees/linkedC:/linked/C:/repo/.git/worktrees/linkedThe published package reproduces this deterministically. Current
mainat2681c3bc815d01aa56e678f45eb98e268c052481still checks only whether the target starts with/.Minimal reproduction
This test injects Windows-style
.gitcontents through the publicRepoFileSystemtrait, so it runs without a Windows host or any actual repository. Create these files and runmoon test --target native.moon.mod
moon.pkg
repro_wbtest.mbt
Actual assertion failure:
Cause and suggested coverage
resolve_gitdirtreats every target not starting with/as relative and prepends the.gitfile's parent.detect_git_diruses that result, so library callers can receive an invalid metadata directory for a Windows linked worktree.Please use platform-aware absolute-path and parent-path handling. Regression coverage should include Windows drive-rooted paths, native-backslash/UNC forms, existing POSIX absolute paths, and ordinary relative
gitdir:paths. Drive-relative paths such asC:relativeshould remain distinct fromC:/absolute.Verification scope
mizchi/bit_remote@0.48.0andmizchi/bit_types@0.48.0.moon 0.1.20260920 (914d7da),moonc v0.10.14+7d59c7ec9.