Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 88 additions & 32 deletions src-tauri/src/commands/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
use crate::git::types::LinuxTerminalEmulator;
use crate::git::types::{
CloneRequest, CommitDetails, CommitDetailsRequest, CommitFileItem, CommitFilesRequest,
CommitMarkers, CommitRequest, DiffRequest, ExportPatchRequest, ExternalDiffRequest,
FetchRequest, FileDiff, FileRequest, GitIdentity, HunkStageRequest, IdentityRequest,
ImportPatchRequest, NumstatRequest, NumstatResult, OperationResult, PullAnalysis,
PullStrategyRequest, PushRequest, PushResult, RepoRequest, RepoStatus, SetIdentityRequest,
StageFilesRequest, StashEntry, StashPushRequest, StashRequest, SubmoduleActionRequest,
CommitMarkers, CommitMessageRecovery, CommitRequest, DiffRequest, ExportCommitPatchRequest,
ExportPatchRequest,
ExternalDiffRequest, FetchRequest, FileDiff, FileRequest, GitIdentity, HunkStageRequest,
IdentityRequest, ImportPatchRequest, NumstatRequest, NumstatResult, OperationResult,
PullAnalysis, PullStrategyRequest, PushRequest, PushResult, RepoRequest, RepoStatus,
SetIdentityRequest, SshAllowedSignerStatus, StageFilesRequest, StashEntry, StashPushRequest,
StashRequest, SubmoduleActionRequest,
};
use crate::{AppState, CloneCancelFlag, configure_command};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -724,6 +726,17 @@ pub fn export_patch_file(
.map_err(|error| error.to_string())
}

#[tauri::command]
pub fn export_commit_patch_file(
request: ExportCommitPatchRequest,
state: tauri::State<'_, AppState>,
) -> Result<OperationResult, String> {
state
.git_service
.export_commit_patch_file(request)
.map_err(|error| error.to_string())
}

#[tauri::command]
pub fn get_repo_diff_tool(
request: RepoRequest,
Expand Down Expand Up @@ -801,24 +814,39 @@ pub async fn get_numstat(
}

#[tauri::command]
pub fn stage_files(
pub async fn stage_files(
request: StageFilesRequest,
state: tauri::State<'_, AppState>,
app: tauri::AppHandle,
) -> Result<OperationResult, String> {
state
.git_service
.stage_files(request)
.map_err(|error| error.to_string())
tauri::async_runtime::spawn_blocking(move || {
app.state::<AppState>().git_service.stage_files(request)
})
.await
.map_err(|e| e.to_string())?
.map_err(|error| error.to_string())
}

#[tauri::command]
pub fn commit_changes(
pub async fn commit_changes(
request: CommitRequest,
state: tauri::State<'_, AppState>,
app: tauri::AppHandle,
) -> Result<OperationResult, String> {
tauri::async_runtime::spawn_blocking(move || {
app.state::<AppState>().git_service.commit_changes(request)
})
.await
.map_err(|e| e.to_string())?
.map_err(|error| error.to_string())
}

#[tauri::command]
pub fn get_commit_message_recovery(
request: RepoRequest,
state: tauri::State<'_, AppState>,
) -> Result<Option<CommitMessageRecovery>, String> {
state
.git_service
.commit_changes(request)
.get_commit_message_recovery(request)
.map_err(|error| error.to_string())
}

Expand All @@ -833,36 +861,42 @@ pub async fn get_diff(request: DiffRequest, app: tauri::AppHandle) -> Result<Fil
}

#[tauri::command]
pub fn unstage_file(
pub async fn unstage_file(
request: FileRequest,
state: tauri::State<'_, AppState>,
app: tauri::AppHandle,
) -> Result<OperationResult, String> {
state
.git_service
.unstage_file(request)
.map_err(|error| error.to_string())
tauri::async_runtime::spawn_blocking(move || {
app.state::<AppState>().git_service.unstage_file(request)
})
.await
.map_err(|e| e.to_string())?
.map_err(|error| error.to_string())
}

#[tauri::command]
pub fn unstage_all(
pub async fn unstage_all(
request: RepoRequest,
state: tauri::State<'_, AppState>,
app: tauri::AppHandle,
) -> Result<OperationResult, String> {
state
.git_service
.unstage_all(request)
.map_err(|error| error.to_string())
tauri::async_runtime::spawn_blocking(move || {
app.state::<AppState>().git_service.unstage_all(request)
})
.await
.map_err(|e| e.to_string())?
.map_err(|error| error.to_string())
}

#[tauri::command]
pub fn stage_all(
pub async fn stage_all(
request: RepoRequest,
state: tauri::State<'_, AppState>,
app: tauri::AppHandle,
) -> Result<OperationResult, String> {
state
.git_service
.stage_all(request)
.map_err(|error| error.to_string())
tauri::async_runtime::spawn_blocking(move || {
app.state::<AppState>().git_service.stage_all(request)
})
.await
.map_err(|e| e.to_string())?
.map_err(|error| error.to_string())
}

#[tauri::command]
Expand Down Expand Up @@ -1045,6 +1079,28 @@ pub fn set_identity(
.map_err(|error| error.to_string())
}

#[tauri::command]
pub fn get_ssh_allowed_signer_status(
request: IdentityRequest,
state: tauri::State<'_, AppState>,
) -> Result<SshAllowedSignerStatus, String> {
state
.git_service
.get_ssh_allowed_signer_status(request)
.map_err(|error| error.to_string())
}

#[tauri::command]
pub fn add_ssh_signing_key_to_allowed_signers(
request: IdentityRequest,
state: tauri::State<'_, AppState>,
) -> Result<OperationResult, String> {
state
.git_service
.add_ssh_signing_key_to_allowed_signers(request)
.map_err(|error| error.to_string())
}

#[tauri::command]
pub async fn push_changes(
request: PushRequest,
Expand Down
10 changes: 2 additions & 8 deletions src-tauri/src/commands/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,8 @@ pub fn get_app_update_channel(state: tauri::State<'_, AppState>) -> AppUpdateCha
}
#[cfg(target_os = "windows")]
if crate::is_msix_build() {
if state
.git_service
.get_settings()
.enable_update_with_ms_store_flow
{
return AppUpdateChannel::MicrosoftStore;
}
return AppUpdateChannel::SystemManaged;
let _ = &state;
return AppUpdateChannel::MicrosoftStore;
}
AppUpdateChannel::SelfManaged
}
Expand Down
Loading