From 0c3cba1dfe12f719ea67ca7d8bf3e60f198745c8 Mon Sep 17 00:00:00 2001 From: Seokju Na Date: Sat, 29 Mar 2025 12:14:12 +0900 Subject: [PATCH 1/7] add a missing status field --- src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 4b26b8c023..541277bfba 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1049,6 +1049,8 @@ bitflags! { const WT_TYPECHANGE = raw::GIT_STATUS_WT_TYPECHANGE as u32; #[allow(missing_docs)] const WT_RENAMED = raw::GIT_STATUS_WT_RENAMED as u32; + #[allow(missing_docs)] + const WT_UNREADABLE = raw::GIT_STATUS_WT_UNREADABLE as u32; #[allow(missing_docs)] const IGNORED = raw::GIT_STATUS_IGNORED as u32; From 00faf61fdbddc976a180ec3490f442bc1bdbd35b Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Thu, 3 Apr 2025 16:28:55 +0200 Subject: [PATCH 2/7] Add missing code checks to Error::raw_code() These codes are both already handled by Error::code(), but because they weren't listed in Error::raw_code(), it would return -1, and so the paths in Error::code() for them would never be hit. This fixes the code of errors from Repository::merge_commits() with fail_on_conflict set for me. --- src/error.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/error.rs b/src/error.rs index 076667af98..ecc7f4f776 100644 --- a/src/error.rs +++ b/src/error.rs @@ -286,6 +286,8 @@ impl Error { GIT_EEOF, GIT_EINVALID, GIT_EUNCOMMITTED, + GIT_EDIRECTORY, + GIT_EMERGECONFLICT, GIT_PASSTHROUGH, GIT_ITEROVER, GIT_RETRY, @@ -294,6 +296,9 @@ impl Error { GIT_EAPPLYFAIL, GIT_EOWNER, GIT_TIMEOUT, + GIT_EUNCHANGED, + GIT_ENOTSUPPORTED, + GIT_EREADONLY, ) } From 38681b13d8ad1cbd056c07336772bcaabf920ba8 Mon Sep 17 00:00:00 2001 From: Redddy Date: Tue, 22 Apr 2025 10:37:34 +0900 Subject: [PATCH 3/7] fix: add a backtick --- src/repo.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/repo.rs b/src/repo.rs index 464530332e..eaabbbf89b 100644 --- a/src/repo.rs +++ b/src/repo.rs @@ -2137,7 +2137,7 @@ impl Repository { /// /// For compatibility with git, the repository is put into a merging state. /// Once the commit is done (or if the user wishes to abort), you should - /// clear this state by calling cleanup_state(). + /// clear this state by calling `cleanup_state()`. pub fn merge( &self, annotated_commits: &[&AnnotatedCommit<'_>], From ba5e1b33483755df7962f5c5771295d12cc6db15 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 22 Apr 2025 06:43:01 -0700 Subject: [PATCH 4/7] Make link an intra-doc link --- src/repo.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/repo.rs b/src/repo.rs index eaabbbf89b..061078d670 100644 --- a/src/repo.rs +++ b/src/repo.rs @@ -2137,7 +2137,7 @@ impl Repository { /// /// For compatibility with git, the repository is put into a merging state. /// Once the commit is done (or if the user wishes to abort), you should - /// clear this state by calling `cleanup_state()`. + /// clear this state by calling [`cleanup_state()`][Repository::cleanup_state]. pub fn merge( &self, annotated_commits: &[&AnnotatedCommit<'_>], From 1774e57b6d11039e04274c0ade9c27d2c768af09 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 5 May 2025 07:45:23 -0700 Subject: [PATCH 5/7] Call init in Indexer::new Otherwise calling `Indexer::new` as the first thing in the program will result in "no error" errors. --- src/indexer.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/indexer.rs b/src/indexer.rs index ddca5fa2d5..be8618b5c6 100644 --- a/src/indexer.rs +++ b/src/indexer.rs @@ -122,6 +122,7 @@ impl<'a> Indexer<'a> { /// /// If `verify` is `false`, the indexer will bypass object connectivity checks. pub fn new(odb: Option<&Odb<'a>>, path: &Path, mode: u32, verify: bool) -> Result { + crate::init(); let path = path.into_c_string()?; let odb = odb.map(Binding::raw).unwrap_or_else(ptr::null_mut); From 7f42b7a08c2fc6fb54e107c357e2b9811e03fe9d Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 5 May 2025 07:49:43 -0700 Subject: [PATCH 6/7] Clarify Indexer::new `path` parameter This updates the docs to clarify that the path is a *directory*. --- src/indexer.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/indexer.rs b/src/indexer.rs index be8618b5c6..3a3ff62a5a 100644 --- a/src/indexer.rs +++ b/src/indexer.rs @@ -118,6 +118,8 @@ impl<'a> Indexer<'a> { /// can be `None` if no thin pack is expected, in which case missing bases /// will result in an error. /// + /// `path` is the directory where the packfile should be stored. + /// /// `mode` is the permissions to use for the output files, use `0` for defaults. /// /// If `verify` is `false`, the indexer will bypass object connectivity checks. From 26bfd30ef25e6f7d7eab361f0ab118df3d1f6161 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 5 May 2025 08:07:56 -0700 Subject: [PATCH 7/7] Update version of git2 to 0.20.2 --- CHANGELOG.md | 15 +++++++++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dca4981310..55ccdc3b4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 0.20.2 - 2025-05-05 +[0.20.1...0.20.2](https://github.com/rust-lang/git2-rs/compare/git2-0.20.1...git2-0.20.2) + +### Added + +- Added `Status::WT_UNREADABLE`. + [#1151](https://github.com/rust-lang/git2-rs/pull/1151) + +### Fixed + +- Added missing codes for `GIT_EDIRECTORY`, `GIT_EMERGECONFLICT`, `GIT_EUNCHANGED`, `GIT_ENOTSUPPORTED`, and `GIT_EREADONLY` to `Error::raw_code`. + [#1153](https://github.com/rust-lang/git2-rs/pull/1153) +- Fixed missing initialization in `Indexer::new`. + [#1160](https://github.com/rust-lang/git2-rs/pull/1160) + ## 0.20.1 - 2025-03-17 [0.20.0...0.20.1](https://github.com/rust-lang/git2-rs/compare/git2-0.20.0...git2-0.20.1) diff --git a/Cargo.lock b/Cargo.lock index 8df8c64719..1d4d2f2fc2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -357,7 +357,7 @@ dependencies = [ [[package]] name = "git2" -version = "0.20.1" +version = "0.20.2" dependencies = [ "bitflags 2.6.0", "clap", diff --git a/Cargo.toml b/Cargo.toml index d0620d7466..02b4ddea8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "git2" -version = "0.20.1" +version = "0.20.2" authors = ["Josh Triplett ", "Alex Crichton "] license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/README.md b/README.md index 7ac0c33826..b96234a095 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ libgit2 bindings for Rust. ```toml [dependencies] -git2 = "0.20.1" +git2 = "0.20.2" ``` ## Rust version requirements