Skip to content

Commit 5adfc06

Browse files
authored
Merge pull request #37 from cst8t/0.9.0-develop
0.9.0 develop
2 parents 944b856 + 46acab3 commit 5adfc06

38 files changed

Lines changed: 4515 additions & 1204 deletions

‎src-tauri/src/commands/repo.rs‎

Lines changed: 88 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
use crate::git::types::LinuxTerminalEmulator;
33
use crate::git::types::{
44
CloneRequest, CommitDetails, CommitDetailsRequest, CommitFileItem, CommitFilesRequest,
5-
CommitMarkers, CommitRequest, DiffRequest, ExportPatchRequest, ExternalDiffRequest,
6-
FetchRequest, FileDiff, FileRequest, GitIdentity, HunkStageRequest, IdentityRequest,
7-
ImportPatchRequest, NumstatRequest, NumstatResult, OperationResult, PullAnalysis,
8-
PullStrategyRequest, PushRequest, PushResult, RepoRequest, RepoStatus, SetIdentityRequest,
9-
StageFilesRequest, StashEntry, StashPushRequest, StashRequest, SubmoduleActionRequest,
5+
CommitMarkers, CommitMessageRecovery, CommitRequest, DiffRequest, ExportCommitPatchRequest,
6+
ExportPatchRequest,
7+
ExternalDiffRequest, FetchRequest, FileDiff, FileRequest, GitIdentity, HunkStageRequest,
8+
IdentityRequest, ImportPatchRequest, NumstatRequest, NumstatResult, OperationResult,
9+
PullAnalysis, PullStrategyRequest, PushRequest, PushResult, RepoRequest, RepoStatus,
10+
SetIdentityRequest, SshAllowedSignerStatus, StageFilesRequest, StashEntry, StashPushRequest,
11+
StashRequest, SubmoduleActionRequest,
1012
};
1113
use crate::{AppState, CloneCancelFlag, configure_command};
1214
use serde::{Deserialize, Serialize};
@@ -724,6 +726,17 @@ pub fn export_patch_file(
724726
.map_err(|error| error.to_string())
725727
}
726728

729+
#[tauri::command]
730+
pub fn export_commit_patch_file(
731+
request: ExportCommitPatchRequest,
732+
state: tauri::State<'_, AppState>,
733+
) -> Result<OperationResult, String> {
734+
state
735+
.git_service
736+
.export_commit_patch_file(request)
737+
.map_err(|error| error.to_string())
738+
}
739+
727740
#[tauri::command]
728741
pub fn get_repo_diff_tool(
729742
request: RepoRequest,
@@ -801,24 +814,39 @@ pub async fn get_numstat(
801814
}
802815

803816
#[tauri::command]
804-
pub fn stage_files(
817+
pub async fn stage_files(
805818
request: StageFilesRequest,
806-
state: tauri::State<'_, AppState>,
819+
app: tauri::AppHandle,
807820
) -> Result<OperationResult, String> {
808-
state
809-
.git_service
810-
.stage_files(request)
811-
.map_err(|error| error.to_string())
821+
tauri::async_runtime::spawn_blocking(move || {
822+
app.state::<AppState>().git_service.stage_files(request)
823+
})
824+
.await
825+
.map_err(|e| e.to_string())?
826+
.map_err(|error| error.to_string())
812827
}
813828

814829
#[tauri::command]
815-
pub fn commit_changes(
830+
pub async fn commit_changes(
816831
request: CommitRequest,
817-
state: tauri::State<'_, AppState>,
832+
app: tauri::AppHandle,
818833
) -> Result<OperationResult, String> {
834+
tauri::async_runtime::spawn_blocking(move || {
835+
app.state::<AppState>().git_service.commit_changes(request)
836+
})
837+
.await
838+
.map_err(|e| e.to_string())?
839+
.map_err(|error| error.to_string())
840+
}
841+
842+
#[tauri::command]
843+
pub fn get_commit_message_recovery(
844+
request: RepoRequest,
845+
state: tauri::State<'_, AppState>,
846+
) -> Result<Option<CommitMessageRecovery>, String> {
819847
state
820848
.git_service
821-
.commit_changes(request)
849+
.get_commit_message_recovery(request)
822850
.map_err(|error| error.to_string())
823851
}
824852

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

835863
#[tauri::command]
836-
pub fn unstage_file(
864+
pub async fn unstage_file(
837865
request: FileRequest,
838-
state: tauri::State<'_, AppState>,
866+
app: tauri::AppHandle,
839867
) -> Result<OperationResult, String> {
840-
state
841-
.git_service
842-
.unstage_file(request)
843-
.map_err(|error| error.to_string())
868+
tauri::async_runtime::spawn_blocking(move || {
869+
app.state::<AppState>().git_service.unstage_file(request)
870+
})
871+
.await
872+
.map_err(|e| e.to_string())?
873+
.map_err(|error| error.to_string())
844874
}
845875

846876
#[tauri::command]
847-
pub fn unstage_all(
877+
pub async fn unstage_all(
848878
request: RepoRequest,
849-
state: tauri::State<'_, AppState>,
879+
app: tauri::AppHandle,
850880
) -> Result<OperationResult, String> {
851-
state
852-
.git_service
853-
.unstage_all(request)
854-
.map_err(|error| error.to_string())
881+
tauri::async_runtime::spawn_blocking(move || {
882+
app.state::<AppState>().git_service.unstage_all(request)
883+
})
884+
.await
885+
.map_err(|e| e.to_string())?
886+
.map_err(|error| error.to_string())
855887
}
856888

857889
#[tauri::command]
858-
pub fn stage_all(
890+
pub async fn stage_all(
859891
request: RepoRequest,
860-
state: tauri::State<'_, AppState>,
892+
app: tauri::AppHandle,
861893
) -> Result<OperationResult, String> {
862-
state
863-
.git_service
864-
.stage_all(request)
865-
.map_err(|error| error.to_string())
894+
tauri::async_runtime::spawn_blocking(move || {
895+
app.state::<AppState>().git_service.stage_all(request)
896+
})
897+
.await
898+
.map_err(|e| e.to_string())?
899+
.map_err(|error| error.to_string())
866900
}
867901

868902
#[tauri::command]
@@ -1045,6 +1079,28 @@ pub fn set_identity(
10451079
.map_err(|error| error.to_string())
10461080
}
10471081

1082+
#[tauri::command]
1083+
pub fn get_ssh_allowed_signer_status(
1084+
request: IdentityRequest,
1085+
state: tauri::State<'_, AppState>,
1086+
) -> Result<SshAllowedSignerStatus, String> {
1087+
state
1088+
.git_service
1089+
.get_ssh_allowed_signer_status(request)
1090+
.map_err(|error| error.to_string())
1091+
}
1092+
1093+
#[tauri::command]
1094+
pub fn add_ssh_signing_key_to_allowed_signers(
1095+
request: IdentityRequest,
1096+
state: tauri::State<'_, AppState>,
1097+
) -> Result<OperationResult, String> {
1098+
state
1099+
.git_service
1100+
.add_ssh_signing_key_to_allowed_signers(request)
1101+
.map_err(|error| error.to_string())
1102+
}
1103+
10481104
#[tauri::command]
10491105
pub async fn push_changes(
10501106
request: PushRequest,

‎src-tauri/src/commands/settings.rs‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -315,14 +315,8 @@ pub fn get_app_update_channel(state: tauri::State<'_, AppState>) -> AppUpdateCha
315315
}
316316
#[cfg(target_os = "windows")]
317317
if crate::is_msix_build() {
318-
if state
319-
.git_service
320-
.get_settings()
321-
.enable_update_with_ms_store_flow
322-
{
323-
return AppUpdateChannel::MicrosoftStore;
324-
}
325-
return AppUpdateChannel::SystemManaged;
318+
let _ = &state;
319+
return AppUpdateChannel::MicrosoftStore;
326320
}
327321
AppUpdateChannel::SelfManaged
328322
}

0 commit comments

Comments
 (0)