Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
089aae5f5b | ||
|
|
841d1a41b7 | ||
|
|
d57b574fe1 |
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "tauri-git-lite",
|
"name": "tauri-git-lite",
|
||||||
"version": "0.0.3",
|
"version": "0.0.5",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "tauri-git-lite",
|
"name": "tauri-git-lite",
|
||||||
"version": "0.0.3",
|
"version": "0.0.5",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lucide/svelte": "^1.21.0",
|
"@lucide/svelte": "^1.21.0",
|
||||||
"@tailwindcss/vite": "^4.3.1",
|
"@tailwindcss/vite": "^4.3.1",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "git-lite",
|
"name": "git-lite",
|
||||||
"version": "0.0.3",
|
"version": "0.0.5",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
+29
-16
@@ -12,6 +12,12 @@ use std::{
|
|||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
use std::os::windows::process::CommandExt;
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
const CREATE_NO_WINDOW: u32 = 0x08000000;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
|
||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
pub enum FileStatusKind {
|
pub enum FileStatusKind {
|
||||||
@@ -143,6 +149,13 @@ const EMPTY_TREE_HASH: &str = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
|
|||||||
const SEARCH_CANCELLED_MESSAGE: &str = "Suche wurde abgebrochen.";
|
const SEARCH_CANCELLED_MESSAGE: &str = "Suche wurde abgebrochen.";
|
||||||
static CANCELLABLE_GIT_OUTPUT_COUNTER: AtomicU64 = AtomicU64::new(0);
|
static CANCELLABLE_GIT_OUTPUT_COUNTER: AtomicU64 = AtomicU64::new(0);
|
||||||
|
|
||||||
|
fn git_command() -> Command {
|
||||||
|
let mut command = Command::new("git");
|
||||||
|
#[cfg(windows)]
|
||||||
|
command.creation_flags(CREATE_NO_WINDOW);
|
||||||
|
command
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
pub struct SearchCancellationState {
|
pub struct SearchCancellationState {
|
||||||
cancelled: Arc<Mutex<BTreeSet<String>>>,
|
cancelled: Arc<Mutex<BTreeSet<String>>>,
|
||||||
@@ -342,7 +355,7 @@ pub fn pull(
|
|||||||
(Some(u), Some(p)) if !u.is_empty() || !p.is_empty() => {
|
(Some(u), Some(p)) if !u.is_empty() || !p.is_empty() => {
|
||||||
run_git_authenticated_output(&repo, pull_args, u, p)?
|
run_git_authenticated_output(&repo, pull_args, u, p)?
|
||||||
}
|
}
|
||||||
_ => Command::new("git")
|
_ => git_command()
|
||||||
.arg("-C")
|
.arg("-C")
|
||||||
.arg(&repo)
|
.arg(&repo)
|
||||||
.args(pull_args)
|
.args(pull_args)
|
||||||
@@ -429,7 +442,7 @@ pub fn get_remote_url(path: String) -> Result<Option<String>, String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn remote_url_for(repo: &Path, remote: &str) -> Option<String> {
|
fn remote_url_for(repo: &Path, remote: &str) -> Option<String> {
|
||||||
let out = Command::new("git")
|
let out = git_command()
|
||||||
.arg("-C")
|
.arg("-C")
|
||||||
.arg(repo)
|
.arg(repo)
|
||||||
.args(["remote", "get-url", remote])
|
.args(["remote", "get-url", remote])
|
||||||
@@ -452,7 +465,7 @@ fn upstream_remote_name(repo: &Path) -> Option<String> {
|
|||||||
if branch.is_empty() || branch == "HEAD" {
|
if branch.is_empty() || branch == "HEAD" {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let out = Command::new("git")
|
let out = git_command()
|
||||||
.arg("-C")
|
.arg("-C")
|
||||||
.arg(repo)
|
.arg(repo)
|
||||||
.args(["config", &format!("branch.{branch}.remote")])
|
.args(["config", &format!("branch.{branch}.remote")])
|
||||||
@@ -530,7 +543,7 @@ pub fn merge_branch(path: String, branch: String) -> Result<GitStatus, String> {
|
|||||||
return Err("Branch-Name darf nicht leer sein.".to_string());
|
return Err("Branch-Name darf nicht leer sein.".to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
let output = Command::new("git")
|
let output = git_command()
|
||||||
.arg("-C")
|
.arg("-C")
|
||||||
.arg(&repo)
|
.arg(&repo)
|
||||||
.args(["merge", "--no-edit", branch])
|
.args(["merge", "--no-edit", branch])
|
||||||
@@ -1106,7 +1119,7 @@ fn is_binary_bytes(bytes: &[u8]) -> bool {
|
|||||||
|
|
||||||
fn index_stage_size(repo: &Path, stage: u8, file: &str) -> Option<u64> {
|
fn index_stage_size(repo: &Path, stage: u8, file: &str) -> Option<u64> {
|
||||||
let spec = format!(":{stage}:{file}");
|
let spec = format!(":{stage}:{file}");
|
||||||
let output = Command::new("git")
|
let output = git_command()
|
||||||
.arg("-C")
|
.arg("-C")
|
||||||
.arg(repo)
|
.arg(repo)
|
||||||
.args(["cat-file", "-s", spec.as_str()])
|
.args(["cat-file", "-s", spec.as_str()])
|
||||||
@@ -1139,7 +1152,7 @@ pub fn resolve_conflict(path: String, file: String, content: String) -> Result<G
|
|||||||
|
|
||||||
fn read_index_stage(repo: &Path, stage: u8, file: &str) -> Option<String> {
|
fn read_index_stage(repo: &Path, stage: u8, file: &str) -> Option<String> {
|
||||||
let spec = format!(":{stage}:{file}");
|
let spec = format!(":{stage}:{file}");
|
||||||
let output = Command::new("git")
|
let output = git_command()
|
||||||
.arg("-C")
|
.arg("-C")
|
||||||
.arg(repo)
|
.arg(repo)
|
||||||
.args(["show", spec.as_str()])
|
.args(["show", spec.as_str()])
|
||||||
@@ -1369,7 +1382,7 @@ fn max_parent_match_count(
|
|||||||
|
|
||||||
fn read_text_blob(repo: &Path, commit: &str, file: &str) -> Result<Option<String>, String> {
|
fn read_text_blob(repo: &Path, commit: &str, file: &str) -> Result<Option<String>, String> {
|
||||||
let spec = format!("{commit}:{file}");
|
let spec = format!("{commit}:{file}");
|
||||||
let output = Command::new("git")
|
let output = git_command()
|
||||||
.arg("-C")
|
.arg("-C")
|
||||||
.arg(repo)
|
.arg(repo)
|
||||||
.args(["show", spec.as_str()])
|
.args(["show", spec.as_str()])
|
||||||
@@ -1823,7 +1836,7 @@ fn local_branch_name_for_remote(remote_branch: &str) -> Option<&str> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn ref_exists(repo: &Path, ref_name: &str) -> Result<bool, String> {
|
fn ref_exists(repo: &Path, ref_name: &str) -> Result<bool, String> {
|
||||||
let output = Command::new("git")
|
let output = git_command()
|
||||||
.arg("-C")
|
.arg("-C")
|
||||||
.arg(repo)
|
.arg(repo)
|
||||||
.args(["show-ref", "--verify", "--quiet", ref_name])
|
.args(["show-ref", "--verify", "--quiet", ref_name])
|
||||||
@@ -2048,7 +2061,7 @@ where
|
|||||||
{
|
{
|
||||||
let askpass = write_askpass_script()?;
|
let askpass = write_askpass_script()?;
|
||||||
|
|
||||||
let result = Command::new("git")
|
let result = git_command()
|
||||||
.arg("-C")
|
.arg("-C")
|
||||||
.arg(repo)
|
.arg(repo)
|
||||||
.args(args)
|
.args(args)
|
||||||
@@ -2157,7 +2170,7 @@ where
|
|||||||
let stderr_file = std::fs::File::create(&stderr_path)
|
let stderr_file = std::fs::File::create(&stderr_path)
|
||||||
.map_err(|err| format!("Git-Fehlerdatei konnte nicht erstellt werden: {err}"))?;
|
.map_err(|err| format!("Git-Fehlerdatei konnte nicht erstellt werden: {err}"))?;
|
||||||
|
|
||||||
let mut child = Command::new("git")
|
let mut child = git_command()
|
||||||
.arg("-C")
|
.arg("-C")
|
||||||
.arg(repo)
|
.arg(repo)
|
||||||
.args(args)
|
.args(args)
|
||||||
@@ -2218,7 +2231,7 @@ where
|
|||||||
I: IntoIterator<Item = S>,
|
I: IntoIterator<Item = S>,
|
||||||
S: AsRef<OsStr>,
|
S: AsRef<OsStr>,
|
||||||
{
|
{
|
||||||
let output = Command::new("git")
|
let output = git_command()
|
||||||
.arg("-C")
|
.arg("-C")
|
||||||
.arg(path)
|
.arg(path)
|
||||||
.args(args)
|
.args(args)
|
||||||
@@ -2442,7 +2455,7 @@ mod tests {
|
|||||||
I: IntoIterator<Item = S>,
|
I: IntoIterator<Item = S>,
|
||||||
S: AsRef<OsStr>,
|
S: AsRef<OsStr>,
|
||||||
{
|
{
|
||||||
let output = Command::new("git")
|
let output = git_command()
|
||||||
.arg("-C")
|
.arg("-C")
|
||||||
.arg(repo)
|
.arg(repo)
|
||||||
.args(args)
|
.args(args)
|
||||||
@@ -2463,7 +2476,7 @@ mod tests {
|
|||||||
I: IntoIterator<Item = S>,
|
I: IntoIterator<Item = S>,
|
||||||
S: AsRef<OsStr>,
|
S: AsRef<OsStr>,
|
||||||
{
|
{
|
||||||
let output = Command::new("git")
|
let output = git_command()
|
||||||
.arg("-C")
|
.arg("-C")
|
||||||
.arg(repo)
|
.arg(repo)
|
||||||
.args(args)
|
.args(args)
|
||||||
@@ -2971,7 +2984,7 @@ mod tests {
|
|||||||
run_git_test(&repo.path, ["commit", "-q", "-am", "main change"]);
|
run_git_test(&repo.path, ["commit", "-q", "-am", "main change"]);
|
||||||
|
|
||||||
// The merge is expected to fail with a conflict, so run git directly.
|
// The merge is expected to fail with a conflict, so run git directly.
|
||||||
let _ = Command::new("git")
|
let _ = git_command()
|
||||||
.arg("-C")
|
.arg("-C")
|
||||||
.arg(&repo.path)
|
.arg(&repo.path)
|
||||||
.args(["merge", "--no-edit", "feature"])
|
.args(["merge", "--no-edit", "feature"])
|
||||||
@@ -3024,7 +3037,7 @@ mod tests {
|
|||||||
fs::write(repo.path.join("file.txt"), "ours change\n").expect("main change");
|
fs::write(repo.path.join("file.txt"), "ours change\n").expect("main change");
|
||||||
run_git_test(&repo.path, ["commit", "-q", "-am", "main change"]);
|
run_git_test(&repo.path, ["commit", "-q", "-am", "main change"]);
|
||||||
|
|
||||||
let _ = Command::new("git")
|
let _ = git_command()
|
||||||
.arg("-C")
|
.arg("-C")
|
||||||
.arg(&repo.path)
|
.arg(&repo.path)
|
||||||
.args(["merge", "--no-edit", "feature"])
|
.args(["merge", "--no-edit", "feature"])
|
||||||
@@ -3065,7 +3078,7 @@ mod tests {
|
|||||||
fs::write(repo.path.join("img.bin"), [0u8, 7, 7]).expect("main binary");
|
fs::write(repo.path.join("img.bin"), [0u8, 7, 7]).expect("main binary");
|
||||||
run_git_test(&repo.path, ["commit", "-q", "-am", "main bin"]);
|
run_git_test(&repo.path, ["commit", "-q", "-am", "main bin"]);
|
||||||
|
|
||||||
let _ = Command::new("git")
|
let _ = git_command()
|
||||||
.arg("-C")
|
.arg("-C")
|
||||||
.arg(&repo.path)
|
.arg(&repo.path)
|
||||||
.args(["merge", "--no-edit", "feature"])
|
.args(["merge", "--no-edit", "feature"])
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "GitLite",
|
"productName": "GitLite",
|
||||||
"version": "0.0.3",
|
"version": "0.0.5",
|
||||||
"identifier": "com.git-lite",
|
"identifier": "com.git-lite",
|
||||||
"build": {
|
"build": {
|
||||||
"beforeDevCommand": "npm run dev",
|
"beforeDevCommand": "npm run dev",
|
||||||
|
|||||||
Reference in New Issue
Block a user