Skip to content

Commit 80d7182

Browse files
committed
fix: adapt OHOS fallbacks to git2 0.21 API changes
- StatusEntry::path() now returns Result instead of Option - Tag::name() returns Option, Tag::message() returns Result
1 parent aab330e commit 80d7182

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

asyncgit/src/sync/status.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ pub fn get_status(
354354
let mut res = Vec::with_capacity(statuses.len());
355355

356356
for entry in statuses.iter() {
357-
let Some(path) = entry.path() else {
357+
let Ok(path) = entry.path() else {
358358
continue;
359359
};
360360

asyncgit/src/sync/tags.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ pub fn get_tags(repo_path: &RepoPath) -> Result<Tags> {
109109
let tag_names = repo.tag_names(None)?;
110110

111111
for name in tag_names.iter().flatten() {
112+
let Some(name) = name else { continue };
113+
112114
let reference = match repo.find_reference(
113115
&format!("refs/tags/{name}"),
114116
) {
@@ -121,7 +123,8 @@ pub fn get_tags(repo_path: &RepoPath) -> Result<Tags> {
121123

122124
if let (Some(commit_id), Ok(tag)) = (target, tag) {
123125
let name = tag.name().unwrap_or(name).to_string();
124-
let annotation = tag.message().map(|s| s.to_string());
126+
let annotation =
127+
tag.message()?.map(ToString::to_string);
125128
adder(commit_id.into(), Tag { name, annotation });
126129
} else if let Some(commit_id) = target {
127130
adder(commit_id.into(), Tag::new(name));

0 commit comments

Comments
 (0)