Pure MoonBit Git implementation
Dependencies
Warning: This is an experimental implementation. Do not use in production. Data corruption may occur in worst case scenarios. Always keep backups of important repositories.
# One-line install
curl -fsSL https://raw.githubusercontent.com/mizchi/bit-vcs/main/install.sh | bash
# Or install via MoonBit toolchain
moon install mizchi/bit# Using @user/repo/path shorthand
bit clone mizchi/bit-vcs:src/vfs
# Or paste GitHub browser URL
bit clone https://github.com/user/repo/tree/main/packages/core
# Single file download
bit clone https://github.com/user/repo/blob/main/README.mdbit clone https://github.com/user/repo
bit checkout -b feature
bit add .
bit commit -m "changes"
bit push origin feature# Initialize PR / Issue metadata once per repository
# `bit pr init` / `bit issue init` ask before creating `.git/hub/policy.toml`
# and before adding `refs/notes/bit-hub` sync settings to `remote.origin.*`.
bit pr init
# Force prompts on/off when scripting
BIT_HUB_INIT_PROMPT=1 bit issue init
BIT_HUB_INIT_PROMPT=0 bit pr init
# Local issues
bit issue create --title "Cache invalidation bug" --body "status view stays stale"
bit issue list --open # top-level issues, with sub-issue counts
bit issue list --tree # parent/child tree
bit issue list --all # flat list including children
bit issue list --parent <issue-id>
# Local pull requests
bit pr create --title "Fix cache invalidation" --body "refresh status after write" \
--head feature/cache-fix --base main
bit pr list --open
bit pr review <pr-id> --approve --commit <commit-hex>
bit pr merge <pr-id>
# Optional relay sync for PR / Issue metadata
bit relay sync push <remote-url>
bit relay sync fetch <remote-url>init add diff diff-files diff-index ls-files tag branch checkout switch
commit log show reflog reset update-ref update-index status merge rebase
clone push fetch pull mv notes stash rm submodule worktree config show-ref
for-each-ref rev-parse symbolic-ref cherry-pick remote cat-file hash-object
ls-tree write-tree commit-tree receive-pack upload-pack pack-objects
index-pack format-patch describe gc clean sparse-checkout restore blame
grep shell rev-list bisect diff-tree read-tree fsck am apply bundle cherry
revert prune pack-refs mktree shortlog verify-pack unpack-objects
maintenance range-diff show-branch repack multi-pack-index pack-redundant
send-pack request-pull merge-base var stripspace ls-remote fmt-merge-msg
patch-id count-objects name-rev update-server-info check-ref-format mktag
interpret-trailers column merge-tree merge-file fast-import fast-export
verify-tag fetch-pack credential difftool rerere mailinfo archive
check-attr check-ignore show-index get-tar-commit-id verify-commit annotate| Test | Result | Notes |
|---|---|---|
| t1300-config | 485/485 | |
| t1450-fsck | 95/95 | |
| t3200-branch | 167/167 | |
| t3206-range-diff | 48/48 | |
| t3500-cherry | 4/4 | |
| t3501-revert-cherry-pick | 21/21 | |
| t3507-cherry-pick-conflict | 44/44 | |
| t4100-apply-stat | 19/19 | all 41 apply tests pass |
| t4150-am | 87/87 | all 11 am tests pass |
| t4201-shortlog | 32/32 | |
| t5300-pack-object | 52/52 | |
| t5304-prune | 32/32 | |
| t5510-fetch | 215/215 | |
| t5607-clone-bundle | 16/16 | all 7 bundle tests pass |
| t6020-bundle-misc | 37/37 | |
| t6101-rev-parse-parents | 38/38 | |
| t6300-for-each-ref | 427/428 | 1 fail: SSH signature |
| t6302-for-each-ref-filter | 62/62 | |
| t7003-filter-branch | 48/48 | |
| t7700-repack | 25/47 | see below |
| t7900-maintenance | 72/72 |
| Feature | Description |
|---|---|
| SHA-256 | --object-format=sha256 repositories not supported |
| Reftable | --ref-format=reftable backend not supported |
| Bitmap writing | pack-objects --write-bitmap-index does not generate .bitmap files |
| Multi-pack-index writing | repack --write-midx is a no-op |
| Commit-graph | No commit-graph generation or reading |
| SSH transport | Only HTTPS remotes; git@host:repo URLs not supported |
| GPG signing | commit -S, tag -s, signature verification |
| Interactive add | add -p / add -i delegate to real git when available |
| Interactive rebase | rebase -i rejected in standalone mode |
| Sparse index | Sparse index format not fully supported |
| Custom merge drivers | .gitattributes merge drivers not supported |
| Command | Missing |
|---|---|
| add | -p (patch), -i (interactive) - delegates to git |
| checkout | --patch, --ours, --theirs, --merge |
| commit | -S (GPG sign), --fixup, --squash |
| diff | --word-diff, --color-words |
| log | --graph rendering (text output only) |
| merge | Octopus merge (3+ heads), custom merge strategies |
| rebase | -i (interactive), --root, --autosquash |
| stash | create, store (low-level plumbing) |
| clean | -X (remove only ignored files, needs gitignore parser) |
| mv | --dry-run, --verbose, --sparse |
| Command | Missing |
|---|---|
| pack-objects | --write-bitmap-index (bitmap generation), tree:N filter (N>0) |
| repack | --write-midx (MIDX generation), bitmap auto-creation in bare repos |
| unpack-objects | -r (recover), --strict |
| apply | --reject (rejection file generation) |
| clone | --filter (partial clone) |
| update-ref | --stdin transaction status output |
| Category | Tests | Reason |
|---|---|---|
| --write-midx | 9 | MIDX generation not implemented |
| --filter (advanced) | 5 | Requires test-tool find-pack |
| Alternate ODB | 4 | Alternate object detection edge cases |
| Bitmap writing | 2 | .bitmap file generation not implemented |
| GIT_TRACE2_EVENT | 1 | git internal tracing, not applicable |
| Pending objects | 1 | --path-walk + fsck output format |
let fs = Fs::from_commit(fs, ".git", commit_id)
let files = fs.readdir(fs, "src")
let content = fs.read_file(fs, "src/main.mbt")let db = Kv::init(fs, fs, git_dir, node_id)
db.set(fs, fs, "users/alice/profile", value, ts)
db.sync_with_peer(fs, fs, peer_url)let hub = Hub::init(fs, fs, git_dir)
let pr = hub.create_pr(fs, fs, "Fix bug", "...",
source_branch, target_branch, author, ts)fn checkout_commit_to_fs(store : ObjectStore, commit_id : ObjectId, fs : &FileSystem, root : String, rfs : &RepoFileSystem) -> Unit raise GitErrorasync fn[FS : AsyncFileSystem + AsyncRepoFileSystem] checkout_commit_to_fs_async(store : ObjectStore, commit_id : ObjectId, fs : FS, root : String) -> Unit raise GitErrorfn hash_object_content_with_algo(algo : HashAlgorithm, obj_type : ObjectType, content : Bytes) -> ObjectIdfn materialize_clone_to_fs(store : ObjectStore, commit_id : ObjectId, refname : String, remote_url : String, fs : &FileSystem, root : String, rfs : &RepoFileSystem) -> Unit raise GitErrorasync fn[FS : AsyncFileSystem + AsyncRepoFileSystem] materialize_clone_to_fs_async(store : ObjectStore, commit_id : ObjectId, refname : String, remote_url : String, fs : FS, root : String) -> Unit raise GitErrorfn write_git_metadata(store : ObjectStore, commit_id : ObjectId, refname : String, remote_url : String, fs : &FileSystem, root : String, rfs : &RepoFileSystem) -> Unit raise GitErrorasync fn[FS : AsyncFileSystem + AsyncRepoFileSystem] write_git_metadata_async(store : ObjectStore, commit_id : ObjectId, refname : String, remote_url : String, fs : FS, root : String) -> Unit raise GitErrorInstall
Download zipPure MoonBit Git implementation
Dependencies