From 26981f32f6492d17df2d7f4243d78ad671791d15 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Fri, 22 Aug 2025 16:23:55 -0700 Subject: [PATCH 1/4] Test features in CI --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 88c3c6c9f1..98ed1523a4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,8 +33,8 @@ jobs: - name: Install Rust (rustup) run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} shell: bash - - run: cargo test --no-default-features --locked - - run: cargo test + - run: cargo test --locked + - run: cargo test --features https,ssh - run: cargo run -p systest - run: cargo test -p git2-curl From fd6d70f9972c4a1961045eb405e0a82c5f895c53 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Fri, 22 Aug 2025 16:24:17 -0700 Subject: [PATCH 2/4] Add docs.rs metadata for features --- Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 4f53a90c03..d56d5a196c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,3 +45,6 @@ zlib-ng-compat = ["libgit2-sys/zlib-ng-compat"] [workspace] members = ["systest", "git2-curl"] + +[package.metadata.docs.rs] +features = ["https", "ssh"] From 05fa593f9404c5d99d1cebfbef7cd35af9a9a60a Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Fri, 22 Aug 2025 16:24:28 -0700 Subject: [PATCH 3/4] Add required features for examples --- Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index d56d5a196c..30a496deaf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,3 +48,6 @@ members = ["systest", "git2-curl"] [package.metadata.docs.rs] features = ["https", "ssh"] + +[[examples]] +required-features = ["https", "ssh"] From dfd9b91461b9e512b5ce94822eb04774bfa5e542 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Fri, 22 Aug 2025 16:27:54 -0700 Subject: [PATCH 4/4] README.md: Add feature documentation --- README.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ca00ad9672..bbbeb54820 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,20 @@ libgit2 bindings for Rust. -```toml -[dependencies] -git2 = "0.21" +``` +cargo add git2 +``` + +## Features + +By default, git2 includes support for working with local repositories, but does +not include network support (e.g. cloning remote repositories). If you want to +use features that require network support, you may need the `"https"` and/or +`"ssh"` features. If you support user-provided repository URLs, you probably +want to enable both. + +``` +cargo add git2 --features https,ssh ``` ## Rust version requirements