mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-10-06 00:47:09 +03:00
make compiler happy
This commit is contained in:
parent
05b94066e6
commit
75d791cdba
@ -1,7 +1,7 @@
|
||||
use super::{Branch, Config, Index, Oid, Reference, Refname, Remote, Result, Url};
|
||||
use git2::{BlameOptions, Signature, Submodule};
|
||||
use super::{Oid, Refname, Result, Url};
|
||||
use git2::{Signature, Submodule};
|
||||
use git2_hooks::HookResult;
|
||||
use std::{path::Path, str};
|
||||
use std::{io::Write, os::unix::fs::PermissionsExt, path::Path, process::Stdio, str};
|
||||
|
||||
// wrapper around git2::Repository to get control over how it's used.
|
||||
pub struct Repository(git2::Repository);
|
||||
|
@ -18,7 +18,7 @@ use crate::git;
|
||||
|
||||
pub fn mark_from_index(
|
||||
repository: &Repository,
|
||||
merge_index: &git::Index,
|
||||
merge_index: &git2::Index,
|
||||
parent: Option<git::Oid>,
|
||||
) -> Result<()> {
|
||||
// mark conflicts
|
||||
|
@ -1,7 +1,6 @@
|
||||
use std::{path::Path, time};
|
||||
|
||||
use anyhow::{anyhow, bail, Context, Result};
|
||||
use git2::Index;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::{
|
||||
@ -414,8 +413,8 @@ pub fn update_base_branch(
|
||||
|
||||
let rebased_head_oid = cherry_rebase(
|
||||
project_repository,
|
||||
new_target_commit.id(),
|
||||
new_target_commit.id(),
|
||||
new_target_commit.id().into(),
|
||||
new_target_commit.id().into(),
|
||||
branch_head.into(),
|
||||
)?
|
||||
.unwrap(); // this should now always work, cleanup later
|
||||
@ -569,8 +568,8 @@ pub fn update_base_branch(
|
||||
// branch was not pushed to upstream yet. attempt a rebase,
|
||||
let rebased_head_oid = cherry_rebase(
|
||||
project_repository,
|
||||
new_target_commit.id(),
|
||||
new_target_commit.id(),
|
||||
new_target_commit.id().into(),
|
||||
new_target_commit.id().into(),
|
||||
branch.head.into(),
|
||||
);
|
||||
|
||||
|
@ -294,7 +294,7 @@ impl Controller {
|
||||
project_id: ProjectId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
) -> Result<(), Error> {
|
||||
) -> Result<()> {
|
||||
self.inner(project_id)
|
||||
.await
|
||||
.resolve_conflict_start(project_id, branch_id, commit_oid)
|
||||
@ -306,7 +306,7 @@ impl Controller {
|
||||
project_id: ProjectId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
) -> Result<git::Oid, Error> {
|
||||
) -> Result<git::Oid> {
|
||||
self.inner(project_id)
|
||||
.await
|
||||
.resolve_conflict_finish(project_id, branch_id, commit_oid)
|
||||
@ -318,7 +318,7 @@ impl Controller {
|
||||
project_id: ProjectId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
) -> Result<(), Error> {
|
||||
) -> Result<()> {
|
||||
self.inner(project_id)
|
||||
.await
|
||||
.resolve_conflict_abandon(project_id, branch_id, commit_oid)
|
||||
@ -794,16 +794,21 @@ impl ControllerInner {
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid
|
||||
) -> Result<(), Error> {
|
||||
commit_oid: git::Oid,
|
||||
) -> Result<()> {
|
||||
let _permit = self.semaphore.acquire().await;
|
||||
|
||||
self.with_verify_branch(project_id, |project_repository, _| {
|
||||
let restore_snapshot = project_repository
|
||||
.project()
|
||||
.create_snapshot(SnapshotDetails::new(OperationKind::ConflictStart))?;
|
||||
super::resolve_conflict_start(project_repository, &branch_id, commit_oid, restore_snapshot)
|
||||
.map_err(Into::into)
|
||||
super::resolve_conflict_start(
|
||||
project_repository,
|
||||
&branch_id,
|
||||
commit_oid,
|
||||
restore_snapshot,
|
||||
)
|
||||
.map_err(Into::into)
|
||||
})
|
||||
}
|
||||
|
||||
@ -812,8 +817,8 @@ impl ControllerInner {
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid
|
||||
) -> Result<git::Oid, Error> {
|
||||
commit_oid: git::Oid,
|
||||
) -> Result<git::Oid> {
|
||||
let _permit = self.semaphore.acquire().await;
|
||||
|
||||
self.with_verify_branch(project_id, |project_repository, _| {
|
||||
@ -829,8 +834,8 @@ impl ControllerInner {
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid
|
||||
) -> Result<(), Error> {
|
||||
commit_oid: git::Oid,
|
||||
) -> Result<()> {
|
||||
let _permit = self.semaphore.acquire().await;
|
||||
|
||||
self.with_verify_branch(project_id, |project_repository, _| {
|
||||
|
@ -3,7 +3,6 @@ use std::path;
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use serde::Serialize;
|
||||
|
||||
use super::errors;
|
||||
use crate::git::{self, diff, CommitExt};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Serialize)]
|
||||
|
@ -54,7 +54,7 @@ pub fn get_workspace_head(
|
||||
let mut workspace_tree = target_commit.tree()?;
|
||||
|
||||
let merge_parent = conflicts::merge_parent(project_repo)?;
|
||||
let is_conflicting = conflicts::is_conflicting::<String>(project_repo, None)?;
|
||||
let is_conflicting = conflicts::is_conflicting(project_repo, None)?;
|
||||
|
||||
if is_conflicting && merge_parent.is_some() {
|
||||
let merge_parent = merge_parent.unwrap();
|
||||
|
@ -3033,7 +3033,7 @@ pub fn resolve_conflict_finish(
|
||||
dbg!("-------- finish conflict resolve -----------");
|
||||
dbg!(&commit_oid);
|
||||
|
||||
if conflicts::is_conflicting::<&Path>(project_repository, None)? {
|
||||
if conflicts::is_conflicting(project_repository, None)? {
|
||||
return Err(anyhow::anyhow!("Conflict is not yet resolved")).context("err");
|
||||
}
|
||||
|
||||
@ -3048,12 +3048,9 @@ pub fn resolve_conflict_finish(
|
||||
// first get a list of the upstream commits
|
||||
let vb_state = project_repository.project().virtual_branches();
|
||||
|
||||
let mut target_branch = match vb_state.get_branch(*branch_id) {
|
||||
Ok(branch) => Ok(branch),
|
||||
Err(reader::Error::NotFound) => return Ok(commit_oid), // this is wrong
|
||||
Err(error) => Err(error),
|
||||
}
|
||||
.context("failed to read branch")?;
|
||||
let mut target_branch = vb_state
|
||||
.get_branch(*branch_id)
|
||||
.context("failed to read branch")?;
|
||||
|
||||
// find all the commits upstream from the target "to" commit
|
||||
let upstream_commits = project_repository.l(
|
||||
@ -3437,7 +3434,7 @@ fn cherry_pick_gitbutler(
|
||||
project_repository: &project_repository::Repository,
|
||||
head: &git2::Commit,
|
||||
to_rebase: &git2::Commit,
|
||||
) -> Result<git::Index, anyhow::Error> {
|
||||
) -> Result<git2::Index, anyhow::Error> {
|
||||
// use that subtree for the merge instead
|
||||
let tree_0 = head.tree()?;
|
||||
let is_conflict_0 = tree_0.get_name(".conflict-side-0");
|
||||
|
Loading…
Reference in New Issue
Block a user