make compiler happy

This commit is contained in:
Scott Chacon 2024-06-03 10:37:30 +02:00
parent 05b94066e6
commit 75d791cdba
No known key found for this signature in database
7 changed files with 30 additions and 30 deletions

View File

@ -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);

View File

@ -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

View File

@ -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(),
);

View File

@ -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, _| {

View File

@ -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)]

View File

@ -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();

View File

@ -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");