1.0 KiB · text 5af55d9

gitgud_gix

Rustler NIF wrapping gitoxide. Provides fast in-process git reads to GitGud.Git.Nif.

When this crate is not built, GitGud.Git transparently uses GitGud.Git.Cli instead — so the rest of the app keeps working without a Rust toolchain.

To wire it in

  1. Add to mix.exs:

    {:rustler, "~> 0.34"}
  2. In lib/git_gud/git/nif.ex, replace the stubs with:

    use Rustler, otp_app: :git_gud, crate: "gitgud_gix"
    def nif_loaded?, do: false # overridden by the NIF on load
    def available?, do: function_exported?(__MODULE__, :nif_loaded?, 0) and nif_loaded?()
  3. mix compile — Rustler will build the crate.

API surface

See src/lib.rs. Currently implemented:

  • nif_loaded?/0
  • init_bare/1
  • list_refs/1
  • blob_bytes/2
  • blob_meta/2
  • resolve/2

Stubbed (returns {:error, :unsupported} — Cli backend handles these):

  • log/3, commit/2, tree/2, diff_stats/3

Fill in incrementally.