mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-02 06:25:02 +03:00
fix sync sign utility
This commit is contained in:
parent
ca714084b1
commit
738e47a377
@ -100,21 +100,29 @@ async fn handle_git_prompt_commit_sign_sync(
|
||||
/// Utility to synchronously sign a commit.
|
||||
/// Uses the Tokio runner to run the async function,
|
||||
/// and the global askpass broker to handle any prompts.
|
||||
pub fn sign_commit_sync<P, Extra>(
|
||||
pub fn sign_commit_sync(
|
||||
repo_path: impl AsRef<Path>,
|
||||
base_commitish: impl AsRef<str>,
|
||||
branch_id: Option<BranchId>,
|
||||
) -> Result<String, impl std::error::Error> {
|
||||
let repo_path = repo_path.as_ref().to_path_buf();
|
||||
let base_commitish: &str = base_commitish.as_ref();
|
||||
let base_commitish = base_commitish.to_string();
|
||||
|
||||
// Run as sync
|
||||
tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap()
|
||||
.block_on(gitbutler_git::sign_commit(
|
||||
repo_path,
|
||||
gitbutler_git::tokio::TokioExecutor,
|
||||
base_commitish.as_ref().to_string(),
|
||||
handle_git_prompt_commit_sign_sync,
|
||||
branch_id,
|
||||
))
|
||||
let handle = std::thread::spawn(move || {
|
||||
tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap()
|
||||
.block_on(gitbutler_git::sign_commit(
|
||||
&repo_path,
|
||||
gitbutler_git::tokio::TokioExecutor,
|
||||
base_commitish,
|
||||
handle_git_prompt_commit_sign_sync,
|
||||
branch_id,
|
||||
))
|
||||
});
|
||||
|
||||
tokio::task::block_in_place(|| handle.join().unwrap())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user