mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-26 02:51:57 +03:00
rm some accidentally duplicated code
This commit is contained in:
parent
f4ec31f81b
commit
665ab4952a
@ -9,7 +9,7 @@ use anyhow::{anyhow, Context, Result};
|
|||||||
use super::conflicts;
|
use super::conflicts;
|
||||||
use crate::{
|
use crate::{
|
||||||
askpass,
|
askpass,
|
||||||
git::{self, Refname, Url},
|
git::{self, Url},
|
||||||
projects::{self, AuthKey},
|
projects::{self, AuthKey},
|
||||||
ssh, users,
|
ssh, users,
|
||||||
virtual_branches::{Branch, BranchId},
|
virtual_branches::{Branch, BranchId},
|
||||||
@ -151,15 +151,11 @@ impl Repository {
|
|||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let target_branch_refname =
|
let target_branch_refname =
|
||||||
git::Refname::from_str(&format!("refs/remotes/{}/{}", remote_name, branch_name))?;
|
git::Refname::from_str(&format!("refs/remotes/{}/{}", remote_name, branch_name))?;
|
||||||
let branch = self.git_repository.find_branch(
|
let branch = self
|
||||||
&target_branch_refname.simple_name(),
|
.git_repository
|
||||||
match target_branch_refname {
|
.find_branch_by_refname(&target_branch_refname)?
|
||||||
Refname::Virtual(_) | Refname::Local(_) | Refname::Other(_) => {
|
.ok_or(anyhow!("failed to find branch {}", target_branch_refname))?;
|
||||||
git2::BranchType::Local
|
|
||||||
}
|
|
||||||
Refname::Remote(_) => git2::BranchType::Remote,
|
|
||||||
},
|
|
||||||
)?;
|
|
||||||
let commit_id: Oid = branch.get().peel_to_commit()?.id().into();
|
let commit_id: Oid = branch.get().peel_to_commit()?.id().into();
|
||||||
|
|
||||||
let now = crate::time::now_ms();
|
let now = crate::time::now_ms();
|
||||||
|
@ -6,7 +6,7 @@ use serde::Serialize;
|
|||||||
|
|
||||||
use super::{target, Author, VirtualBranchesHandle};
|
use super::{target, Author, VirtualBranchesHandle};
|
||||||
use crate::{
|
use crate::{
|
||||||
git::{self, CommitExt, Refname},
|
git::{self, CommitExt, RepositoryExt},
|
||||||
project_repository::{self, LogUntil},
|
project_repository::{self, LogUntil},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -91,16 +91,8 @@ pub fn get_branch_data(
|
|||||||
|
|
||||||
let branch = project_repository
|
let branch = project_repository
|
||||||
.repo()
|
.repo()
|
||||||
.find_branch(
|
.find_branch_by_refname(refname)?
|
||||||
&refname.simple_name(),
|
.ok_or(anyhow::anyhow!("failed to find branch {}", refname))?;
|
||||||
match refname {
|
|
||||||
Refname::Virtual(_) | Refname::Local(_) | Refname::Other(_) => {
|
|
||||||
git2::BranchType::Local
|
|
||||||
}
|
|
||||||
Refname::Remote(_) => git2::BranchType::Remote,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.context(format!("failed to find branch with refname {refname}"))?;
|
|
||||||
|
|
||||||
branch_to_remote_branch_data(project_repository, &branch, default_target.sha)?
|
branch_to_remote_branch_data(project_repository, &branch, default_target.sha)?
|
||||||
.context("failed to get branch data")
|
.context("failed to get branch data")
|
||||||
|
Loading…
Reference in New Issue
Block a user