mbox series

[v3,0/6] Introduce libgit-rs, a Rust wrapper around libgit.a

Message ID 20240906221853.257984-1-calvinwan@google.com (mailing list archive)
Headers show
Series Introduce libgit-rs, a Rust wrapper around libgit.a | expand

Message

Calvin Wan Sept. 6, 2024, 10:18 p.m. UTC
This series provides two small Rust wrapper libraries around parts of
Git: "libgit-sys", which exposes a few functions from libgit.a, and
"libgit", which provides a more Rust-friendly interface to some of those
functions. In addition to included unit tests, at $DAYJOB we have tested
building JJ[1] with our library and used it to replace some of the
libgit2-rs uses.

[1] https://github.com/martinvonz/jj

Please find V1 cover letter here:
https://lore.kernel.org/git/cover.1723054623.git.steadmon@google.com/

Changes in V3:
* Renamed cgit-rs to libgit-rs and cgit-sys to libgit-sys

* Makefile cleanup, particularly adding config.mak options that
  developers can set to run Rust builds and tests by default (Patch 6)

* Provide testdata configs for unit tests

* ConfigSet API now uses &Path instead of &str -- more ergonomic for
  Rust users to pass in and errors out if the path string isn't UTF-8

* Fixed unresolved dependency on libz in Cargo.toml

Known NEEDSWORK:

* Supports older Rust versions by removing any dependencies introduced
  after 1.63.0 (Debian stable)

* Investigate alternative methods of managing symbol visibility.

* Figure out symbol versioning

* Automate the process of exporting additional functions in libgit-sys
  (possibly with a wrapper script around bindgen)

Calvin Wan (3):
  libgit-sys: add repo initialization and config access
  libgit: add higher-level libgit crate
  Makefile: add option to build and test libgit-rs and libgit-rs-sys

Josh Steadmon (3):
  common-main: split init and exit code into new files
  libgit-sys: introduce Rust wrapper for libgit.a
  config: add git_configset_alloc() and git_configset_clear_and_free()

 .gitignore                                    |   2 +
 Makefile                                      |  31 +++++
 common-exit.c                                 |  26 ++++
 common-init.c                                 |  63 +++++++++
 common-init.h                                 |   6 +
 common-main.c                                 |  83 +-----------
 config.c                                      |  11 ++
 config.h                                      |  10 ++
 contrib/libgit-rs/Cargo.lock                  |  62 +++++++++
 contrib/libgit-rs/Cargo.toml                  |  10 ++
 contrib/libgit-rs/libgit-sys/Cargo.lock       |  55 ++++++++
 contrib/libgit-rs/libgit-sys/Cargo.toml       |  12 ++
 contrib/libgit-rs/libgit-sys/README.md        |  15 +++
 contrib/libgit-rs/libgit-sys/build.rs         |  31 +++++
 .../libgit-sys/public_symbol_export.c         |  76 +++++++++++
 .../libgit-sys/public_symbol_export.h         |  28 ++++
 contrib/libgit-rs/libgit-sys/src/lib.rs       | 124 ++++++++++++++++++
 contrib/libgit-rs/src/lib.rs                  |  85 ++++++++++++
 contrib/libgit-rs/testdata/config1            |   2 +
 contrib/libgit-rs/testdata/config2            |   2 +
 contrib/libgit-rs/testdata/config3            |   2 +
 t/Makefile                                    |  16 +++
 22 files changed, 671 insertions(+), 81 deletions(-)
 create mode 100644 common-exit.c
 create mode 100644 common-init.c
 create mode 100644 common-init.h
 create mode 100644 contrib/libgit-rs/Cargo.lock
 create mode 100644 contrib/libgit-rs/Cargo.toml
 create mode 100644 contrib/libgit-rs/libgit-sys/Cargo.lock
 create mode 100644 contrib/libgit-rs/libgit-sys/Cargo.toml
 create mode 100644 contrib/libgit-rs/libgit-sys/README.md
 create mode 100644 contrib/libgit-rs/libgit-sys/build.rs
 create mode 100644 contrib/libgit-rs/libgit-sys/public_symbol_export.c
 create mode 100644 contrib/libgit-rs/libgit-sys/public_symbol_export.h
 create mode 100644 contrib/libgit-rs/libgit-sys/src/lib.rs
 create mode 100644 contrib/libgit-rs/src/lib.rs
 create mode 100644 contrib/libgit-rs/testdata/config1
 create mode 100644 contrib/libgit-rs/testdata/config2
 create mode 100644 contrib/libgit-rs/testdata/config3