diff --git a/Cranky.toml b/Cranky.toml index 352d6cd3a..103c4d63e 100644 --- a/Cranky.toml +++ b/Cranky.toml @@ -52,12 +52,12 @@ deny = [ "clippy::unneeded_field_pattern", "clippy::unseparated_literal_suffix", "clippy::if_then_some_else_none", - "clippy::use_debug" + "clippy::use_debug", #TODO: - #clippy::partial_pub_fields - #clippy::print_stdout - #clippy::unwrap_used - #clippy::unwrap_in_result + # "clippy::partial_pub_fields" + # "clippy::print_stdout" + # "clippy::unwrap_used" + # "clippy::unwrap_in_result" ] allow = [ diff --git a/packages/tauri/src/gb_repository/repository.rs b/packages/tauri/src/gb_repository/repository.rs index 440911718..c824f2457 100644 --- a/packages/tauri/src/gb_repository/repository.rs +++ b/packages/tauri/src/gb_repository/repository.rs @@ -26,7 +26,7 @@ use crate::{ }; pub struct Repository { - pub git_repository: git::Repository, + git_repository: git::Repository, project: projects::Project, lock_file: std::fs::File, } @@ -610,6 +610,10 @@ impl Repository { Ok(()) } + + pub fn git_repository(&self) -> &git::Repository { + &self.git_repository + } } fn build_wd_tree( diff --git a/packages/tauri/src/sessions/reader.rs b/packages/tauri/src/sessions/reader.rs index 28ff15f8a..564c53b9e 100644 --- a/packages/tauri/src/sessions/reader.rs +++ b/packages/tauri/src/sessions/reader.rs @@ -42,11 +42,11 @@ impl<'reader> SessionReader<'reader> { wd_reader.read(&repository.session_path().join("meta").join("id")) { if current_session_id == session.id.to_string() { - let head_commit = repository.git_repository.head()?.peel_to_commit()?; + let head_commit = repository.git_repository().head()?.peel_to_commit()?; return Ok(SessionReader { reader: Box::new(wd_reader), previous_reader: CommitReader::from_commit( - &repository.git_repository, + repository.git_repository(), &head_commit, )?, }); @@ -67,15 +67,16 @@ impl<'reader> SessionReader<'reader> { .context(format!("failed to parse commit hash {}", session_hash))?; let commit = repository - .git_repository + .git_repository() .find_commit(oid) .context("failed to get commit")?; - let commit_reader = reader::CommitReader::from_commit(&repository.git_repository, &commit)?; + let commit_reader = + reader::CommitReader::from_commit(repository.git_repository(), &commit)?; Ok(SessionReader { reader: Box::new(commit_reader), previous_reader: reader::CommitReader::from_commit( - &repository.git_repository, + repository.git_repository(), &commit.parent(0)?, )?, }) diff --git a/packages/tauri/src/virtual_branches/virtual.rs b/packages/tauri/src/virtual_branches/virtual.rs index 74be23603..f3b463247 100644 --- a/packages/tauri/src/virtual_branches/virtual.rs +++ b/packages/tauri/src/virtual_branches/virtual.rs @@ -968,7 +968,7 @@ pub fn create_virtual_branch( .read_default() .context("failed to read default")?; - let repo = &gb_repository.git_repository; + let repo = gb_repository.git_repository(); let commit = repo .find_commit(default_target.sha) .context("failed to find commit")?; diff --git a/scripts/check.sh b/scripts/check.sh index d182a034f..bbbc48f9e 100755 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -7,7 +7,8 @@ set -o pipefail function rust() { cargo fmt --check cargo sort -c -w - cargo cranky --all-targets --all-features + # use nightly as long cranky is run in nightly on ci + cargo +nightly cranky --all-targets --all-features cargo test }