Skip to content

aferobilly — billy→afero adapter

This adapter has been extracted to the standalone module gitlab.com/phpboyscout/go/aferobilly.

It presents a go-billy/v5 Filesystem as an afero.Fs. go-git worktrees expose their filesystem as billy; most Go code is written against afero. The adapter bridges the two so afero-based code can read and write a git worktree directly — one source of truth, no materialise-and-sync step.

It was extracted as its own module rather than folded into repo because it is not VCS-specific: it works with any billy filesystem (memfs, osfs, chroot), and burying it inside a git module would have hidden it behind a dependency its users don't want.

What moved, and what to read there

The module's docs carry the full detail, including the two things most likely to bite a caller:

  • The billy↔afero semantics table — every place the two interfaces disagree and why each mismatch is resolved the way it is (Mkdir creates parents; Chmod/Chown/Chtimes are no-ops; directories get a synthesised read-only handle; the symlink argument-order trap).
  • The concurrency guide — per-operation locking, why the wrapped billy object is deliberately unreachable, and both footguns: operations are atomic but sequences are not, and the locker is non-reentrant.

GTB usage

GTB no longer imports this module directly. It arrives transitively via repo, which uses it to implement the WorkFS() / WithWorkFS() worktree accessors described in Repo.

  • Repo — how GTB wires the extracted go/repo module
  • VCS index — package overview