Move a bunch of git ops to use the git binary (#302)

This commit is contained in:
Gregory Schier
2025-11-17 15:22:39 -08:00
committed by GitHub
parent 84219571e8
commit 9c52652a5e
43 changed files with 1238 additions and 1176 deletions

View File

@@ -1,13 +1,19 @@
use crate::add::git_add;
use crate::branch::{git_checkout_branch, git_create_branch, git_delete_branch, git_merge_branch};
use crate::commit::git_commit;
use crate::credential::git_add_credential;
use crate::error::Result;
use crate::fetch::git_fetch_all;
use crate::git::{
git_add, git_commit, git_init, git_log, git_status, git_unstage, GitCommit, GitStatusSummary,
};
use crate::pull::{git_pull, PullResult};
use crate::push::{git_push, PushResult};
use crate::init::git_init;
use crate::log::{GitCommit, git_log};
use crate::pull::{PullResult, git_pull};
use crate::push::{PushResult, git_push};
use crate::remotes::{GitRemote, git_add_remote, git_remotes, git_rm_remote};
use crate::status::{GitStatusSummary, git_status};
use crate::unstage::git_unstage;
use std::path::{Path, PathBuf};
use tauri::command;
// NOTE: All of these commands are async to prevent blocking work from locking up the UI
#[command]
@@ -80,3 +86,28 @@ pub async fn unstage(dir: &Path, rela_paths: Vec<PathBuf>) -> Result<()> {
}
Ok(())
}
#[command]
pub async fn add_credential(
dir: &Path,
remote_url: &str,
username: &str,
password: &str,
) -> Result<()> {
git_add_credential(dir, remote_url, username, password).await
}
#[command]
pub async fn remotes(dir: &Path) -> Result<Vec<GitRemote>> {
git_remotes(dir)
}
#[command]
pub async fn add_remote(dir: &Path, name: &str, url: &str) -> Result<GitRemote> {
git_add_remote(dir, name, url)
}
#[command]
pub async fn rm_remote(dir: &Path, name: &str) -> Result<()> {
git_rm_remote(dir, name)
}