diff --git a/lib/src/git.rs b/lib/src/git.rs index 330294ff1..acd841a08 100644 --- a/lib/src/git.rs +++ b/lib/src/git.rs @@ -146,9 +146,7 @@ fn local_branch_git_tracking_refs(view: &View) -> impl Iterator(view: &'a View, branch: &str) -> &'a RefTarget { - view.git_refs() - .get(&format!("refs/heads/{branch}")) - .flatten() + view.get_git_ref(&format!("refs/heads/{branch}")) } fn prevent_gc(git_repo: &git2::Repository, id: &CommitId) -> Result<(), git2::Error> { diff --git a/lib/src/revset.rs b/lib/src/revset.rs index 378038c78..9d8881a55 100644 --- a/lib/src/revset.rs +++ b/lib/src/revset.rs @@ -1635,8 +1635,9 @@ fn resolve_git_ref(repo: &dyn Repo, symbol: &str) -> Option> { // TODO: We should remove `refs/remotes` from this list once we have a better // way to address local git repo's remote-tracking branches. for git_ref_prefix in &["", "refs/", "refs/tags/", "refs/remotes/"] { - if let Some(ref_target) = view.git_refs().get(&(git_ref_prefix.to_string() + symbol)) { - return Some(ref_target.added_ids().cloned().collect()); + let target = view.get_git_ref(&(git_ref_prefix.to_string() + symbol)); + if target.is_present() { + return Some(target.added_ids().cloned().collect()); } } None