<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/contrib/libgit-sys/src, branch main</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=main</id>
<link rel='self' href='https://git.shady.money/git/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2025-01-29T23:06:50Z</updated>
<entry>
<title>libgit: add higher-level libgit crate</title>
<updated>2025-01-29T23:06:50Z</updated>
<author>
<name>Calvin Wan</name>
<email>calvinwan@google.com</email>
</author>
<published>2025-01-29T21:50:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=65c10aa8d5000e0ecab34a9652056f0520fe51ed'/>
<id>urn:sha1:65c10aa8d5000e0ecab34a9652056f0520fe51ed</id>
<content type='text'>
The C functions exported by libgit-sys do not provide an idiomatic Rust
interface. To make it easier to use these functions via Rust, add a
higher-level "libgit" crate, that wraps the lower-level configset API
with an interface that is more Rust-y.

This combination of $X and $X-sys crates is a common pattern for FFI in
Rust, as documented in "The Cargo Book" [1].

[1] https://doc.rust-lang.org/cargo/reference/build-scripts.html#-sys-packages

Co-authored-by: Josh Steadmon &lt;steadmon@google.com&gt;
Signed-off-by: Josh Steadmon &lt;steadmon@google.com&gt;
Signed-off-by: Calvin Wan &lt;calvinwan@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>libgit-sys: also export some config_set functions</title>
<updated>2025-01-29T23:06:50Z</updated>
<author>
<name>Josh Steadmon</name>
<email>steadmon@google.com</email>
</author>
<published>2025-01-29T21:50:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d76eb0dcccb19d2f85924a4be177ae76126bf5d3'/>
<id>urn:sha1:d76eb0dcccb19d2f85924a4be177ae76126bf5d3</id>
<content type='text'>
In preparation for implementing a higher-level Rust API for accessing
Git configs, export some of the upstream configset API via libgitpub and
libgit-sys. Since this will be exercised as part of the higher-level API
in the next commit, no tests have been added for libgit-sys.

While we're at it, add git_configset_alloc() and git_configset_free()
functions in libgitpub so that callers can manage config_set structs on
the heap. This also allows non-C external consumers to treat config_sets
as opaque structs.

Co-authored-by: Calvin Wan &lt;calvinwan@google.com&gt;
Signed-off-by: Calvin Wan &lt;calvinwan@google.com&gt;
Signed-off-by: Josh Steadmon &lt;steadmon@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>libgit-sys: introduce Rust wrapper for libgit.a</title>
<updated>2025-01-28T22:45:47Z</updated>
<author>
<name>Josh Steadmon</name>
<email>steadmon@google.com</email>
</author>
<published>2025-01-28T22:01:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e7f8bf125c078004232e254e71b97226c4fed81b'/>
<id>urn:sha1:e7f8bf125c078004232e254e71b97226c4fed81b</id>
<content type='text'>
Introduce libgit-sys, a Rust wrapper crate that allows Rust code to call
functions in libgit.a. This initial patch defines build rules and an
interface that exposes user agent string getter functions as a proof of
concept. This library can be tested with `cargo test`. In later commits,
a higher-level library containing a more Rust-friendly interface will be
added at `contrib/libgit-rs`.

Symbols in libgit can collide with symbols from other libraries such as
libgit2. We avoid this by first exposing library symbols in
public_symbol_export.[ch]. These symbols are prepended with "libgit_" to
avoid collisions and set to visible using a visibility pragma. In
build.rs, Rust builds contrib/libgit-rs/libgit-sys/libgitpub.a, which also
contains libgit.a and other dependent libraries, with
-fvisibility=hidden to hide all symbols within those libraries that
haven't been exposed with a visibility pragma.

Co-authored-by: Kyle Lippincott &lt;spectral@google.com&gt;
Co-authored-by: Calvin Wan &lt;calvinwan@google.com&gt;
Signed-off-by: Calvin Wan &lt;calvinwan@google.com&gt;
Signed-off-by: Kyle Lippincott &lt;spectral@google.com&gt;
Signed-off-by: Josh Steadmon &lt;steadmon@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
