Merge pull request #4283 from gitbutlerapp/move-author-and-askpass-mods

move author and askpass mods
This commit is contained in:
Kiril Videlov 2024-07-08 20:17:29 +02:00 committed by GitHub
commit a8615f81f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 18 additions and 15 deletions

2
Cargo.lock generated
View File

@ -2336,7 +2336,9 @@ dependencies = [
"gitbutler-project",
"gitbutler-testsupport",
"gitbutler-user",
"log",
"resolve-path",
"serde",
"serde_json",
"tempfile",
"thiserror",

View File

@ -1,11 +1,11 @@
use anyhow::Result;
use futures::future::join_all;
use gitbutler_core::virtual_branches::Author;
use gitbutler_user as users;
use std::{collections::HashMap, path, sync, time::Duration};
use url::Url;
use crate::{
author::Author,
base::BaseBranch,
remote::{RemoteBranchData, RemoteCommit},
VirtualBranch, VirtualBranchCommit,

View File

@ -16,3 +16,5 @@ pub mod files;
pub mod remote;
pub mod conflicts;
mod author;

View File

@ -8,7 +8,9 @@ use gitbutler_repo::{LogUntil, RepoActions, RepositoryExt};
use serde::Serialize;
use gitbutler_core::git::{self, CommitExt};
use gitbutler_core::virtual_branches::{target, Author};
use gitbutler_core::virtual_branches::target;
use crate::author::Author;
// this struct is a mapping to the view `RemoteBranch` type in Typescript
// found in src-tauri/src/routes/repo/[project_id]/types.ts

View File

@ -19,10 +19,10 @@ use diffy::{apply_bytes as diffy_apply, Line, Patch};
use git2::build::TreeUpdateBuilder;
use git2::ErrorCode;
use git2_hooks::HookResult;
use gitbutler_core::virtual_branches::Author;
use hex::ToHex;
use serde::{Deserialize, Serialize};
use crate::author::Author;
use crate::conflicts::{self, RepoConflicts};
use crate::integration::{get_integration_commiter, get_workspace_head};
use crate::remote::{branch_to_remote_branch, RemoteBranch};

View File

@ -13,7 +13,6 @@
clippy::too_many_lines
)]
pub mod askpass;
pub mod dedup;
pub mod error;
pub mod fs;

View File

@ -2,9 +2,6 @@ pub mod branch;
pub use branch::{Branch, BranchId};
pub mod target;
mod author;
pub use author::Author;
use lazy_static::lazy_static;
lazy_static! {
pub static ref GITBUTLER_INTEGRATION_REFERENCE: crate::git::LocalRefname =

View File

@ -14,6 +14,8 @@ tokio = { workspace = true, features = [ "rt-multi-thread", "rt", "macros" ] }
gitbutler-git.workspace = true
tracing = "0.1.40"
tempfile = "3.10"
serde = { workspace = true, features = ["std"]}
log = "^0.4"
thiserror.workspace = true
resolve-path = "0.1.0"
gitbutler-command-context.workspace = true

View File

@ -3,7 +3,7 @@ use std::{collections::HashMap, path::Path, sync::Arc};
use serde::Serialize;
use tokio::sync::{oneshot, Mutex};
use crate::{id::Id, virtual_branches::BranchId};
use gitbutler_core::{id::Id, virtual_branches::BranchId};
static mut GLOBAL_ASKPASS_BROKER: Option<AskpassBroker> = None;

View File

@ -14,3 +14,5 @@ pub mod credentials;
mod config;
pub use config::Config;
pub mod askpass;

View File

@ -4,14 +4,13 @@ use anyhow::{anyhow, Context, Result};
use gitbutler_command_context::ProjectRepo;
use gitbutler_core::{
askpass,
error::Code,
git::{self, CommitHeadersV2},
ssh,
virtual_branches::{Branch, BranchId},
};
use crate::Config;
use crate::{askpass, Config};
use gitbutler_project::AuthKey;
use crate::{credentials::Helper, RepositoryExt};

View File

@ -1,8 +1,6 @@
pub mod commands {
use gitbutler_core::{
askpass::{self, AskpassRequest},
id::Id,
};
use gitbutler_core::id::Id;
use gitbutler_repo::askpass::{self, AskpassRequest};
#[tauri::command(async)]
#[tracing::instrument(skip(response))]

View File

@ -82,7 +82,7 @@ fn main() {
// SAFETY(qix-): This is safe because we're initializing the askpass broker here,
// SAFETY(qix-): before any other threads would ever access it.
unsafe {
gitbutler_core::askpass::init({
gitbutler_repo::askpass::init({
let handle = app_handle.clone();
move |event| {
handle.emit_all("git_prompt", event).expect("tauri event emission doesn't fail in practice")