add auto-updater and git workflow enhancements
publish / publish-tauri (, windows-latest) (release) Failing after 2m52s

This change introduces a comprehensive auto-update mechanism for the application and significant improvements to the integrated Git client experience.

Key features include:
- **Automated Release Workflow:** A new Gitea Actions workflow (`app_builder.yaml`) and a Python `cicd_tool` are added to automatically build, sign, and upload release artifacts to S3-compatible storage (MinIO) upon a new release. This also generates the `latest.json` file required by the updater.
- **Tauri Updater Integration:** The `tauri-plugin-updater` is integrated into the application, enabling it to check for and apply updates seamlessly.
- **Robust Git Push Handling:** The application now intelligently handles non-fast-forward push failures by prompting the user to perform a pull/merge operation before re-attempting the push.
- **Enhanced File Comparison:** A new `compare_file_to_parent` command is introduced, allowing detailed file diffs against a commit's direct parent, including the "empty tree" for initial commits.
- **Explorer Panel Improvements:** "Expand All" and "Collapse All" functionality is added to the file explorer for better navigation.
This commit is contained in:
Christoph Brandau
2026-06-30 13:23:30 +02:00
parent 4aa9a537f0
commit 58bd246221
19 changed files with 1283 additions and 37 deletions
+7
View File
@@ -0,0 +1,7 @@
added 1 package, and audited 67 packages in 5s
13 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
+327 -5
View File
@@ -58,6 +58,15 @@ version = "1.0.102"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
[[package]]
name = "arbitrary"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"
dependencies = [
"derive_arbitrary",
]
[[package]]
name = "async-broadcast"
version = "0.7.2"
@@ -754,6 +763,17 @@ dependencies = [
"serde_core",
]
[[package]]
name = "derive_arbitrary"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.118",
]
[[package]]
name = "derive_more"
version = "2.1.1"
@@ -1039,6 +1059,16 @@ dependencies = [
"rustc_version",
]
[[package]]
name = "filetime"
version = "0.2.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759"
dependencies = [
"cfg-if",
"libc",
]
[[package]]
name = "find-msvc-tools"
version = "0.1.9"
@@ -1601,6 +1631,21 @@ dependencies = [
"want",
]
[[package]]
name = "hyper-rustls"
version = "0.27.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f"
dependencies = [
"http",
"hyper",
"hyper-util",
"rustls",
"tokio",
"tokio-rustls",
"tower-service",
]
[[package]]
name = "hyper-util"
version = "0.1.20"
@@ -1860,6 +1905,36 @@ dependencies = [
"windows-sys 0.45.0",
]
[[package]]
name = "jni"
version = "0.22.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498"
dependencies = [
"cfg-if",
"combine",
"jni-macros",
"jni-sys 0.4.1",
"log",
"simd_cesu8",
"thiserror 2.0.18",
"walkdir",
"windows-link 0.2.1",
]
[[package]]
name = "jni-macros"
version = "0.22.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3"
dependencies = [
"proc-macro2",
"quote",
"rustc_version",
"simd_cesu8",
"syn 2.0.118",
]
[[package]]
name = "jni-sys"
version = "0.3.1"
@@ -2066,6 +2141,12 @@ version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
name = "minisign-verify"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22f9645cb765ea72b8111f36c522475d2daa0d22c957a9826437e97534bc4e9e"
[[package]]
name = "miniz_oxide"
version = "0.8.9"
@@ -2391,6 +2472,18 @@ dependencies = [
"objc2-core-foundation",
]
[[package]]
name = "objc2-osa-kit"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f112d1746737b0da274ef79a23aac283376f335f4095a083a267a082f21db0c0"
dependencies = [
"bitflags 2.13.0",
"objc2",
"objc2-app-kit",
"objc2-foundation",
]
[[package]]
name = "objc2-quartz-core"
version = "0.3.2"
@@ -2454,6 +2547,12 @@ version = "1.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
[[package]]
name = "openssl-probe"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"
[[package]]
name = "option-ext"
version = "0.2.0"
@@ -2470,6 +2569,20 @@ dependencies = [
"pin-project-lite",
]
[[package]]
name = "osakit"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "732c71caeaa72c065bb69d7ea08717bd3f4863a4f451402fc9513e29dbd5261b"
dependencies = [
"objc2",
"objc2-foundation",
"objc2-osa-kit",
"serde",
"serde_json",
"thiserror 2.0.18",
]
[[package]]
name = "pango"
version = "0.18.3"
@@ -2900,15 +3013,20 @@ dependencies = [
"http-body",
"http-body-util",
"hyper",
"hyper-rustls",
"hyper-util",
"js-sys",
"log",
"percent-encoding",
"pin-project-lite",
"rustls",
"rustls-pki-types",
"rustls-platform-verifier",
"serde",
"serde_json",
"sync_wrapper",
"tokio",
"tokio-rustls",
"tokio-util",
"tower",
"tower-http",
@@ -2944,6 +3062,20 @@ dependencies = [
"windows-sys 0.60.2",
]
[[package]]
name = "ring"
version = "0.17.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
dependencies = [
"cc",
"cfg-if",
"getrandom 0.2.17",
"libc",
"untrusted",
"windows-sys 0.52.0",
]
[[package]]
name = "rustc-hash"
version = "2.1.2"
@@ -2972,6 +3104,79 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "rustls"
version = "0.23.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b92b125634d9b795e7beca796cc790df15a7fb38323bf3196fda83292d06b1f"
dependencies = [
"once_cell",
"ring",
"rustls-pki-types",
"rustls-webpki",
"subtle",
"zeroize",
]
[[package]]
name = "rustls-native-certs"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dab5152771c58876a2146916e53e35057e1a4dfa2b9df0f0305b07f611fdea4d"
dependencies = [
"openssl-probe",
"rustls-pki-types",
"schannel",
"security-framework 3.7.0",
]
[[package]]
name = "rustls-pki-types"
version = "1.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30a7197ae7eb376e574fe940d068c30fe0462554a3ddbe4eca7838e049c937a9"
dependencies = [
"zeroize",
]
[[package]]
name = "rustls-platform-verifier"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26d1e2536ce4f35f4846aa13bff16bd0ff40157cdb14cc056c7b14ba41233ba0"
dependencies = [
"core-foundation 0.10.1",
"core-foundation-sys",
"jni 0.22.4",
"log",
"once_cell",
"rustls",
"rustls-native-certs",
"rustls-platform-verifier-android",
"rustls-webpki",
"security-framework 3.7.0",
"security-framework-sys",
"webpki-root-certs",
"windows-sys 0.61.2",
]
[[package]]
name = "rustls-platform-verifier-android"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"
[[package]]
name = "rustls-webpki"
version = "0.103.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e"
dependencies = [
"ring",
"rustls-pki-types",
"untrusted",
]
[[package]]
name = "rustversion"
version = "1.0.22"
@@ -2987,6 +3192,15 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "schannel"
version = "0.1.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939"
dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "schemars"
version = "0.8.22"
@@ -3330,6 +3544,22 @@ version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214"
[[package]]
name = "simd_cesu8"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94f90157bb87cddf702797c5dadfa0be7d266cdf49e22da2fcaa32eff75b2c33"
dependencies = [
"rustc_version",
"simdutf8",
]
[[package]]
name = "simdutf8"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
[[package]]
name = "siphasher"
version = "1.0.3"
@@ -3537,7 +3767,7 @@ dependencies = [
"gdkwayland-sys",
"gdkx11-sys",
"gtk",
"jni",
"jni 0.21.1",
"libc",
"log",
"ndk",
@@ -3570,6 +3800,17 @@ dependencies = [
"syn 2.0.118",
]
[[package]]
name = "tar"
version = "0.4.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840"
dependencies = [
"filetime",
"libc",
"xattr",
]
[[package]]
name = "target-lexicon"
version = "0.12.16"
@@ -3593,7 +3834,7 @@ dependencies = [
"gtk",
"heck 0.5.0",
"http",
"jni",
"jni 0.21.1",
"libc",
"log",
"mime",
@@ -3747,6 +3988,39 @@ dependencies = [
"url",
]
[[package]]
name = "tauri-plugin-updater"
version = "2.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "806d9dac662c2e4594ff03c647a552f2c9bd544e7d0f683ec58f872f952ce4af"
dependencies = [
"base64 0.22.1",
"dirs",
"flate2",
"futures-util",
"http",
"infer",
"log",
"minisign-verify",
"osakit",
"percent-encoding",
"reqwest",
"rustls",
"semver",
"serde",
"serde_json",
"tar",
"tauri",
"tauri-plugin",
"tempfile",
"thiserror 2.0.18",
"time",
"tokio",
"url",
"windows-sys 0.60.2",
"zip",
]
[[package]]
name = "tauri-runtime"
version = "2.11.3"
@@ -3757,7 +4031,7 @@ dependencies = [
"dpi",
"gtk",
"http",
"jni",
"jni 0.21.1",
"objc2",
"objc2-ui-kit",
"objc2-web-kit",
@@ -3780,7 +4054,7 @@ checksum = "fe41e015bf8fc4d6477ff4926a0ef769dc64ff34c7b0038b6f7cacae892acb5c"
dependencies = [
"gtk",
"http",
"jni",
"jni 0.21.1",
"log",
"objc2",
"objc2-app-kit",
@@ -3857,6 +4131,7 @@ dependencies = [
"tauri",
"tauri-build",
"tauri-plugin-dialog",
"tauri-plugin-updater",
]
[[package]]
@@ -3991,6 +4266,16 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "tokio-rustls"
version = "0.26.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61"
dependencies = [
"rustls",
"tokio",
]
[[package]]
name = "tokio-util"
version = "0.7.18"
@@ -4304,6 +4589,12 @@ version = "1.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8"
[[package]]
name = "untrusted"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "url"
version = "2.5.8"
@@ -4553,6 +4844,15 @@ dependencies = [
"system-deps",
]
[[package]]
name = "webpki-root-certs"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d46a5a140e6f7afeccd8eae97eff335163939eac8b929834875168b29b3d267"
dependencies = [
"rustls-pki-types",
]
[[package]]
name = "webview2-com"
version = "0.38.2"
@@ -5087,7 +5387,7 @@ dependencies = [
"gtk",
"http",
"javascriptcore-rs",
"jni",
"jni 0.21.1",
"libc",
"ndk",
"objc2",
@@ -5134,6 +5434,16 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "xattr"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156"
dependencies = [
"libc",
"rustix",
]
[[package]]
name = "xdg-home"
version = "1.3.0"
@@ -5323,6 +5633,18 @@ dependencies = [
"syn 2.0.118",
]
[[package]]
name = "zip"
version = "4.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "caa8cd6af31c3b31c6631b8f483848b91589021b28fffe50adada48d4f4d2ed1"
dependencies = [
"arbitrary",
"crc32fast",
"indexmap 2.14.0",
"memchr",
]
[[package]]
name = "zmij"
version = "1.0.21"
+3
View File
@@ -15,3 +15,6 @@ keyring = { version = "3", features = ["apple-native", "windows-native", "async-
[build-dependencies]
tauri-build = { version = "2", features = [] }
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-updater = "2"
+14
View File
@@ -0,0 +1,14 @@
{
"identifier": "desktop-capability",
"platforms": [
"macOS",
"windows",
"linux"
],
"windows": [
"main"
],
"permissions": [
"updater:default"
]
}
+228 -18
View File
@@ -3,7 +3,7 @@ use std::{
collections::{BTreeMap, BTreeSet},
ffi::{OsStr, OsString},
path::{Path, PathBuf},
process::{Command, Stdio},
process::{Command, Output, Stdio},
sync::{
atomic::{AtomicU64, Ordering},
Arc, Mutex,
@@ -139,6 +139,7 @@ enum CheckoutPlan {
}
const FULL_FILE_DIFF_CONTEXT: &str = "--unified=1000000";
const EMPTY_TREE_HASH: &str = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
const SEARCH_CANCELLED_MESSAGE: &str = "Suche wurde abgebrochen.";
static CANCELLABLE_GIT_OUTPUT_COUNTER: AtomicU64 = AtomicU64::new(0);
@@ -336,15 +337,35 @@ pub fn pull(
password: Option<String>,
) -> Result<GitStatus, String> {
let repo = resolve_repo(&path)?;
match (username.as_deref(), password.as_deref()) {
let pull_args = ["pull", "--no-rebase", "--ff", "--no-edit"];
let output = match (username.as_deref(), password.as_deref()) {
(Some(u), Some(p)) if !u.is_empty() || !p.is_empty() => {
run_git_authenticated(&repo, ["pull", "--ff-only"], u, p)?;
}
_ => {
run_git(&repo, ["pull", "--ff-only"])?;
run_git_authenticated_output(&repo, pull_args, u, p)?
}
_ => Command::new("git")
.arg("-C")
.arg(&repo)
.args(pull_args)
.output()
.map_err(|err| {
format!("Git konnte nicht gestartet werden. Ist Git installiert? {err}")
})?,
};
if output.status.success() {
return status_for_repo(&repo);
}
status_for_repo(&repo)
let status = status_for_repo(&repo)?;
if has_unresolved_conflicts(&status) {
return Ok(status);
}
let details = command_output_details(&output);
if is_auth_error(&details) {
return Err(format!("AUTH_FAILED:{details}"));
}
Err(format!("Git-Befehl fehlgeschlagen: {details}"))
}
#[tauri::command]
@@ -949,6 +970,78 @@ pub fn compare_file_to_head(
})
}
#[tauri::command]
pub fn compare_file_to_parent(
path: String,
commit: String,
file: String,
old_file: Option<String>,
) -> Result<GitCommitComparison, String> {
let repo = resolve_repo(&path)?;
let mut pathspecs = Vec::new();
if let Some(old_file) = old_file.filter(|value| !value.trim().is_empty() && value != &file) {
pathspecs.push(old_file);
}
pathspecs.push(file);
validate_files(&pathspecs)?;
let commit_hash = verify_commit(&repo, &commit)?;
let parents = commit_parents(&repo, &commit_hash)?;
let (from_hash, from_short) = if let Some(parent) = parents.first() {
(parent.clone(), short_hash(parent))
} else {
(EMPTY_TREE_HASH.to_string(), "empty tree".to_string())
};
let name_status = run_git_with_paths(
&repo,
&[
"diff",
"--name-status",
"-M",
"-z",
from_hash.as_str(),
commit_hash.as_str(),
],
&pathspecs,
)?;
let numstat = run_git_with_paths(
&repo,
&[
"diff",
"--numstat",
"-M",
"-z",
from_hash.as_str(),
commit_hash.as_str(),
],
&pathspecs,
)?;
let patch_output = run_git_with_paths(
&repo,
&[
"diff",
"-M",
FULL_FILE_DIFF_CONTEXT,
from_hash.as_str(),
commit_hash.as_str(),
],
&pathspecs,
)?;
let files = parse_diff_files(&name_status, &numstat)?;
let patch = String::from_utf8_lossy(&patch_output).to_string();
Ok(GitCommitComparison {
from_short,
to_short: short_hash(&commit_hash),
from_hash,
to_hash: commit_hash,
files,
patch,
})
}
#[tauri::command]
pub fn read_conflict(path: String, file: String) -> Result<ConflictFile, String> {
let repo = resolve_repo(&path)?;
@@ -1926,6 +2019,29 @@ fn run_git_authenticated<I, S>(
username: &str,
password: &str,
) -> Result<Vec<u8>, String>
where
I: IntoIterator<Item = S>,
S: AsRef<OsStr>,
{
let output = run_git_authenticated_output(repo, args, username, password)?;
if output.status.success() {
return Ok(output.stdout);
}
let details = command_output_details(&output);
if is_auth_error(&details) {
return Err(format!("AUTH_FAILED:{details}"));
}
Err(format!("Git-Befehl fehlgeschlagen: {details}"))
}
fn run_git_authenticated_output<I, S>(
repo: &Path,
args: I,
username: &str,
password: &str,
) -> Result<Output, String>
where
I: IntoIterator<Item = S>,
S: AsRef<OsStr>,
@@ -1944,26 +2060,19 @@ where
.map_err(|err| format!("Git konnte nicht gestartet werden: {err}"));
let _ = std::fs::remove_file(&askpass);
result
}
let output = result?;
if output.status.success() {
return Ok(output.stdout);
}
fn command_output_details(output: &Output) -> String {
let stderr = String::from_utf8_lossy(&output.stderr);
let stdout = String::from_utf8_lossy(&output.stdout);
let details = if !stderr.trim().is_empty() {
if !stderr.trim().is_empty() {
stderr.trim().to_string()
} else if !stdout.trim().is_empty() {
stdout.trim().to_string()
} else {
"Unbekannter Fehler".to_string()
};
if is_auth_error(&details) {
return Err(format!("AUTH_FAILED:{details}"));
}
Err(format!("Git-Befehl fehlgeschlagen: {details}"))
}
/// Heuristic: did git fail because the credentials were rejected/expired,
@@ -2744,6 +2853,107 @@ mod tests {
assert!(!comparison.patch.contains("other file"));
}
#[test]
fn compare_file_to_parent_reports_selected_file_change_in_commit() {
let repo = init_temp_repo("compare_file_to_parent");
commit_initial_file(&repo.path);
let first_commit = git_output_test(&repo.path, ["rev-parse", "HEAD"]);
fs::write(repo.path.join("old.txt"), "original\nsecond line\n")
.expect("tracked file should change");
fs::write(repo.path.join("other.txt"), "other file\n")
.expect("other file should be written");
run_git_test(&repo.path, ["add", "old.txt", "other.txt"]);
run_git_test(&repo.path, ["commit", "-q", "-m", "second"]);
let second_commit = git_output_test(&repo.path, ["rev-parse", "HEAD"]);
let comparison = compare_file_to_parent(
repo.path.to_string_lossy().to_string(),
second_commit.clone(),
"old.txt".to_string(),
None,
)
.unwrap();
assert_eq!(comparison.from_hash, first_commit);
assert_eq!(comparison.to_hash, second_commit);
assert_eq!(comparison.files.len(), 1);
assert_eq!(comparison.files[0].path, "old.txt");
assert!(comparison.patch.contains("second line"));
assert!(!comparison.patch.contains("other file"));
}
#[test]
fn compare_file_to_parent_uses_empty_tree_for_initial_commit() {
let repo = init_temp_repo("compare_file_to_parent_initial");
commit_initial_file(&repo.path);
let initial_commit = git_output_test(&repo.path, ["rev-parse", "HEAD"]);
let comparison = compare_file_to_parent(
repo.path.to_string_lossy().to_string(),
initial_commit.clone(),
"old.txt".to_string(),
None,
)
.unwrap();
assert_eq!(comparison.from_hash, EMPTY_TREE_HASH);
assert_eq!(comparison.from_short, "empty tree");
assert_eq!(comparison.to_hash, initial_commit);
assert_eq!(comparison.files.len(), 1);
assert_eq!(comparison.files[0].path, "old.txt");
assert!(comparison.patch.contains("+original"));
}
#[test]
#[cfg_attr(
windows,
ignore = "Git for Windows can fail local pull tests with a sh signal pipe error"
)]
fn pull_merges_diverging_branch_instead_of_requiring_fast_forward() {
let repo = init_temp_repo("pull_diverged");
commit_initial_file(&repo.path);
let base_branch = git_output_test(&repo.path, ["rev-parse", "--abbrev-ref", "HEAD"]);
run_git_test(&repo.path, ["checkout", "-q", "-b", "remote-change"]);
fs::write(repo.path.join("remote.txt"), "remote change\n")
.expect("remote file should be written");
run_git_test(&repo.path, ["add", "remote.txt"]);
run_git_test(&repo.path, ["commit", "-q", "-m", "remote change"]);
run_git_test(&repo.path, ["checkout", "-q", base_branch.as_str()]);
fs::write(repo.path.join("local.txt"), "local change\n")
.expect("local file should be written");
run_git_test(&repo.path, ["add", "local.txt"]);
run_git_test(&repo.path, ["commit", "-q", "-m", "local change"]);
run_git_test(&repo.path, ["remote", "add", "origin", "."]);
run_git_test(
&repo.path,
["config", &format!("branch.{base_branch}.remote"), "origin"],
);
run_git_test(
&repo.path,
[
"config",
&format!("branch.{base_branch}.merge"),
"refs/heads/remote-change",
],
);
let status = pull(repo.path.to_string_lossy().to_string(), None, None).unwrap();
assert!(status.clean, "{:?}", status.files);
assert!(repo.path.join("remote.txt").exists());
assert!(repo.path.join("local.txt").exists());
let parent_count =
git_output_test(&repo.path, ["rev-list", "--parents", "-n", "1", "HEAD"])
.split_whitespace()
.count()
- 1;
assert_eq!(parent_count, 2);
}
#[test]
fn read_and_resolve_conflict_round_trip() {
let repo = init_temp_repo("resolve_conflict");
+8 -5
View File
@@ -4,15 +4,17 @@ mod git;
use git::{
cancel_code_search, checkout_branch, commit, compare_commits, compare_file_to_head,
cred_delete, cred_load, cred_save, diff_file_against_working_tree, get_remote_url, get_status,
list_branches, list_commits, list_file_history, list_repository_files, merge_branch,
open_repository, pull, push, read_conflict, resolve_conflict, resolve_conflict_side,
restore_file_from_commit, restore_files, restore_to_commit, search_code_introductions,
stage_files, unstage_files, SearchCancellationState,
compare_file_to_parent, cred_delete, cred_load, cred_save, diff_file_against_working_tree,
get_remote_url, get_status, list_branches, list_commits, list_file_history,
list_repository_files, merge_branch, open_repository, pull, push, read_conflict,
resolve_conflict, resolve_conflict_side, restore_file_from_commit, restore_files,
restore_to_commit, search_code_introductions, stage_files, unstage_files,
SearchCancellationState,
};
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_updater::Builder::new().build())
.manage(SearchCancellationState::default())
.plugin(tauri_plugin_dialog::init())
.invoke_handler(tauri::generate_handler![
@@ -34,6 +36,7 @@ fn main() {
list_file_history,
compare_commits,
compare_file_to_head,
compare_file_to_parent,
diff_file_against_working_tree,
search_code_introductions,
cancel_code_search,
+15 -1
View File
@@ -29,6 +29,20 @@
"bundle": {
"active": true,
"targets": "all",
"icon": ["icons/icon.ico"]
"icon": ["icons/icon.ico"],
"createUpdaterArtifacts": true,
"windows": {
"nsis": {
"installMode": "currentUser"
}
}
},
"plugins": {
"updater": {
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDdDNEJGRTZERTREOTc5QjkKUldTNWVkbmtiZjVMZk02YzdpenVLOVltREJpRkFrc2F4dUwzaTV5M3pacFRVR0tmd25xSGtjK1MK",
"endpoints" : [
"https://cdn.cbsk-tech.de/GitLite/latest.json"
]
}
}
}