feat(tauri): add single instance plugin and improve code formatting
This update introduces the tauri-plugin-single-instance to ensure that only one instance of the application can run at a time. Additionally, the code has been reformatted for better readability, with consistent line breaks and spacing. - Added single instance plugin to prevent multiple app instances - Improved code formatting for better readability and maintenance - Updated dependencies in Cargo.toml for new plugin integration
This commit is contained in:
+20
-4
@@ -681,7 +681,14 @@ pub fn create_tag(
|
||||
Some(message) => {
|
||||
run_git(
|
||||
&repo,
|
||||
["tag", "-a", name.as_str(), "-m", message.as_str(), target.as_str()],
|
||||
[
|
||||
"tag",
|
||||
"-a",
|
||||
name.as_str(),
|
||||
"-m",
|
||||
message.as_str(),
|
||||
target.as_str(),
|
||||
],
|
||||
)?;
|
||||
}
|
||||
None => {
|
||||
@@ -755,7 +762,11 @@ fn validate_existing_tag_name(repo: &Path, name: &str) -> Result<String, String>
|
||||
|
||||
fn validate_tag_ref_name(name: &str) -> Result<String, String> {
|
||||
let output = git_command()
|
||||
.args(["check-ref-format", "--allow-onelevel", &format!("refs/tags/{name}")])
|
||||
.args([
|
||||
"check-ref-format",
|
||||
"--allow-onelevel",
|
||||
&format!("refs/tags/{name}"),
|
||||
])
|
||||
.output()
|
||||
.map_err(|err| format!("Could not start Git. Is Git installed? {err}"))?;
|
||||
|
||||
@@ -1096,7 +1107,11 @@ pub fn last_commit_message(path: String) -> Result<Option<String>, String> {
|
||||
|
||||
let output = run_git(&repo, ["log", "-1", "--format=%B", "HEAD"])?;
|
||||
let message = String::from_utf8_lossy(&output).trim_end().to_string();
|
||||
Ok(if message.is_empty() { None } else { Some(message) })
|
||||
Ok(if message.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(message)
|
||||
})
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
@@ -5544,7 +5559,8 @@ mod tests {
|
||||
fn get_file_blame_attributes_lines_to_the_commits_that_introduced_them() {
|
||||
let repo = init_temp_repo("file_blame");
|
||||
commit_initial_file(&repo.path);
|
||||
fs::write(repo.path.join("old.txt"), "original\ntwo\n").expect("tracked file should change");
|
||||
fs::write(repo.path.join("old.txt"), "original\ntwo\n")
|
||||
.expect("tracked file should change");
|
||||
run_git_test(&repo.path, ["add", "old.txt"]);
|
||||
run_git_test(&repo.path, ["commit", "-q", "-m", "add second line"]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user