mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 17:08:21 +00:00
cleanup
This commit is contained in:
parent
23516f1a41
commit
9f8fc6b907
1 changed files with 12 additions and 13 deletions
|
|
@ -8,18 +8,6 @@ use crate::{
|
|||
|
||||
use super::CommitId;
|
||||
|
||||
fn rebase_branch_repo(
|
||||
repo: &Repository,
|
||||
branch_name: &str,
|
||||
) -> Result<CommitId> {
|
||||
let branch = repo.find_branch(branch_name, BranchType::Local)?;
|
||||
|
||||
let annotated =
|
||||
repo.reference_to_annotated_commit(&branch.into_reference())?;
|
||||
|
||||
conflict_free_rebase(repo, &annotated)
|
||||
}
|
||||
|
||||
/// rebase current HEAD on `branch`
|
||||
pub fn rebase_branch(
|
||||
repo_path: &str,
|
||||
|
|
@ -32,6 +20,18 @@ pub fn rebase_branch(
|
|||
rebase_branch_repo(&repo, branch)
|
||||
}
|
||||
|
||||
fn rebase_branch_repo(
|
||||
repo: &Repository,
|
||||
branch_name: &str,
|
||||
) -> Result<CommitId> {
|
||||
let branch = repo.find_branch(branch_name, BranchType::Local)?;
|
||||
|
||||
let annotated =
|
||||
repo.reference_to_annotated_commit(&branch.into_reference())?;
|
||||
|
||||
conflict_free_rebase(repo, &annotated)
|
||||
}
|
||||
|
||||
/// rebase attempt which aborts and undo's rebase if any conflict appears
|
||||
pub fn conflict_free_rebase(
|
||||
repo: &git2::Repository,
|
||||
|
|
@ -43,7 +43,6 @@ pub fn conflict_free_rebase(
|
|||
let mut last_commit = None;
|
||||
while let Some(op) = rebase.next() {
|
||||
let _op = op?;
|
||||
// dbg!(op.id());
|
||||
|
||||
if repo.index()?.has_conflicts() {
|
||||
rebase.abort()?;
|
||||
|
|
|
|||
Loading…
Reference in a new issue