mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-30 16:10:23 +00:00
view: replace .git_refs().get(name) with .get_git_ref(name)
This commit is contained in:
parent
84f0c96c8f
commit
92ee5121f6
2 changed files with 4 additions and 5 deletions
|
@ -146,9 +146,7 @@ fn local_branch_git_tracking_refs(view: &View) -> impl Iterator<Item = (&str, &R
|
|||
}
|
||||
|
||||
pub fn get_local_git_tracking_branch<'a>(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> {
|
||||
|
|
|
@ -1635,8 +1635,9 @@ fn resolve_git_ref(repo: &dyn Repo, symbol: &str) -> Option<Vec<CommitId>> {
|
|||
// 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
|
||||
|
|
Loading…
Reference in a new issue