B-ZDX9-backup-embed-a-git-library-instead-of-a-binary
Not scheduled. Related: T-UPPP-backup-bundle-git (ships a git binary in the app), B-NNS4-backup-off-machine-remote-with-full-history (needs push), M-PZGL.
determined-backup shells out to git, and T-UPPP-backup-bundle-git ships a pinned binary so
the app does not depend on developer tools. A library linked into the app would remove the binary,
the process spawns, the GIT_EXEC_PATH setup for helpers such as git-upload-pack, and the
build-machine template path. git.rs is the only module that spawns git, so a
swap is contained there.
Options
Section titled “Options”git2 (libgit2) | gix (gitoxide) | |
|---|---|---|
| License | GPLv2 with a linking exception | MIT or Apache-2.0 |
| Language | C library with Rust bindings | Pure Rust |
| Maturity | Mature, stable API | Pre-1.0; diff and status still moving |
| Speed | Slower than git on large repos | Fast |
| Push | Supported | Not yet |
| Shallow clone over local transport | Uncertain | To check |
| Worktree staging and commit | Supported | Needs more code |
| Exec-path and templates | Not needed: no helper programs, no compiled-in template path | Same |
Cost either way
Section titled “Cost either way”lib.rsties the crate to git’s text output:log --raw,diff-tree --numstat -z,ls-tree -r -l -zand others, checked by the parity cases. A library must reproduce numstat’s binary rule,--root’s all-added first commit and--no-renames.- The prune’s shallow clone needs an equivalent in the library.
- Time list snapshots, stage and commit a snapshot, numstat for one snapshot, and a shallow prune on a store of about 5 GB, against the git CLI.
- Check shallow clone from a local store and push from a shallow store, for both libraries.
- Check the parity cases’ outputs can be reproduced.
Open questions
Section titled “Open questions”- Is the bundled binary enough, so this never pays off?
- Does push support decide it, given B-NNS4-backup-off-machine-remote-with-full-history?