From 9e31145a860d69ee26bb36f992b0555364871531 Mon Sep 17 00:00:00 2001 From: Abdelilah El Aissaoui Date: Sun, 24 Dec 2023 21:30:09 +0100 Subject: [PATCH] Code cleanup --- .github/FUNDING.yml | 2 +- DEVELOPMENT.md | 24 ++++++++++++------- README.md | 6 +++-- rs/Cargo.toml | 4 ++-- rs/src/lib.rs | 11 +++++---- rs/src/ssh.rs | 8 ++++--- rs/src/watch_directory.rs | 1 + .../kotlin/com/jetpackduba/gitnuro/App.kt | 8 ++++--- .../credentials/CredentialsCacheRepository.kt | 1 + .../gitnuro/credentials/GSessionManager.kt | 2 +- .../credentials/HttpCredentialsProvider.kt | 4 +--- .../jetpackduba/gitnuro/di/TabComponent.kt | 2 -- .../gitnuro/exceptions/FetchException.kt | 2 +- .../gitnuro/extensions/ModifierExtensions.kt | 19 ++++++++------- .../jetpackduba/gitnuro/git/RawFileManager.kt | 2 +- .../com/jetpackduba/gitnuro/git/TaskEvent.kt | 1 - .../git/branches/SetTrackingBranchUseCase.kt | 1 - .../git/config/LocalConfigConstants.kt | 3 ++- .../gitnuro/git/diff/DiffResult.kt | 2 +- .../gitnuro/git/log/GetLogUseCase.kt | 2 +- .../GetRebaseInteractiveStateUseCase.kt | 1 + .../FetchAllBranchesUseCase.kt | 7 +++--- .../HandleTransportUseCase.kt | 3 ++- .../remote_operations/PullBranchUseCase.kt | 3 +-- .../OpenSubmoduleRepositoryUseCase.kt | 3 ++- .../git/submodules/DeleteSubmoduleUseCase.kt | 1 - .../gitnuro/git/workspace/DoCommitUseCase.kt | 2 +- .../gitnuro/git/workspace/ResetHunkUseCase.kt | 1 - .../gitnuro/managers/AppFilesManager.kt | 2 +- .../gitnuro/managers/TempFilesManager.kt | 1 - .../gitnuro/models/ProgressMonitorInfo.kt | 4 ---- .../gitnuro/system/OpenFilePickerUseCase.kt | 7 +++++- .../gitnuro/terminal/MacTerminalProvider.kt | 5 +++- .../terminal/WindowsTerminalProvider.kt | 1 - .../com/jetpackduba/gitnuro/ui/Blame.kt | 4 +++- .../jetpackduba/gitnuro/ui/CommitChanges.kt | 9 +++++-- .../gitnuro/ui/components/FilterDropdown.kt | 11 +++++---- .../ui/components/RepositoriesTabPanel.kt | 8 +++++-- .../gitnuro/ui/components/SideMenuSubentry.kt | 3 ++- .../gitnuro/ui/components/TextLink.kt | 1 - .../ui/context_menu/BranchContextMenu.kt | 2 +- .../gitnuro/ui/context_menu/ContextMenu.kt | 3 ++- .../ui/context_menu/SubmoduleContextMenu.kt | 2 +- .../gitnuro/ui/dialogs/AddSubmoduleDialog.kt | 2 +- .../gitnuro/ui/dialogs/ResetDialog.kt | 4 +++- .../dialogs/SetDefaultUpstreamBranchDialog.kt | 5 +++- .../gitnuro/updates/UpdatesRepository.kt | 2 +- .../viewmodels/CommitChangesViewModel.kt | 2 +- .../gitnuro/viewmodels/DiffViewModel.kt | 16 ++++++------- .../gitnuro/viewmodels/HistoryViewModel.kt | 6 ++++- .../gitnuro/viewmodels/LogViewModel.kt | 2 +- .../gitnuro/viewmodels/SettingsViewModel.kt | 6 ++++- .../gitnuro/viewmodels/StatusViewModel.kt | 7 +++--- .../gitnuro/viewmodels/TabViewModel.kt | 1 + .../gitnuro/viewmodels/TabViewModelsHolder.kt | 4 ++-- .../viewmodels/sidepanel/StashesViewModel.kt | 1 - .../sidepanel/SubmoduleDialogViewModel.kt | 6 +++-- .../sidepanel/SubmodulesViewModel.kt | 6 ++++- src/main/resources/copy.svg | 5 +++- src/main/resources/cut.svg | 8 ++++++- src/main/resources/description.svg | 5 +++- src/main/resources/done.svg | 5 +++- src/main/resources/drag.svg | 4 +++- src/main/resources/horizontal_split.svg | 5 +++- src/main/resources/layout.svg | 6 ++++- src/main/resources/list.svg | 8 ++++++- src/main/resources/network.svg | 5 +++- src/main/resources/palette.svg | 20 +++++++++++++++- src/main/resources/password.svg | 4 +++- src/main/resources/paste.svg | 5 +++- src/main/resources/remove_done.svg | 5 +++- src/main/resources/security.svg | 4 +++- src/main/resources/sign.svg | 14 ++++++++++- src/main/resources/sync.svg | 5 +++- src/main/resources/unified.svg | 16 ++++++------- src/main/resources/update.svg | 14 ++++++++++- src/main/resources/vertical_split.svg | 18 +++++++------- src/main/resources/visibility.svg | 5 +++- src/main/resources/visibility_off.svg | 5 +++- .../git/branches/CheckoutRefUseCaseTest.kt | 9 ++++--- ...erateSplitHunkFromDiffResultUseCaseTest.kt | 3 +-- 81 files changed, 289 insertions(+), 148 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 962d1c85..160e683b 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,6 +1,6 @@ # These are supported funding model platforms -github: [JetpackDuba] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +github: [ JetpackDuba ] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] patreon: # Replace with a single Patreon username open_collective: # Replace with a single Open Collective username ko_fi: # Replace with a single Ko-fi username diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index ce8ffdf4..cd0f46a9 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -2,12 +2,16 @@ ## Requirements -- **JDK 17 or higher**: You don't need this if you only use the JDK installed by IntelliJ IDEA. If you want to build using the CLI, check this [section](#alternative-setting-up-jdk-for-use-on-cli). -- **Rust:** Gitnuro is mainly written in Kotlin (JVM) but also uses Rust for some specific tasks. To set up your Rust environment, -please read [its documentation](https://www.rust-lang.org/). `cargo` and `rustc` must be available in the path in order to build Gitnuro properly. +- **JDK 17 or higher**: You don't need this if you only use the JDK installed by IntelliJ IDEA. If you want to build + using the CLI, check this [section](#alternative-setting-up-jdk-for-use-on-cli). +- **Rust:** Gitnuro is mainly written in Kotlin (JVM) but also uses Rust for some specific tasks. To set up your Rust + environment, + please read [its documentation](https://www.rust-lang.org/). `cargo` and `rustc` must be available in the path in + order to build Gitnuro properly. - **Perl:** Perl is required to build openssl (which is required for LibSSH to work). -- **Packages for Linux ARM64/aarch64**: You need to install the `aarch64-linux-gnu-gcc` package to cross compile the -Rust components to ARM from x86_64. You will also need to use `rustup` to add a new target: `rustup target add aarch64-unknown-linux-gnu` +- **Packages for Linux ARM64/aarch64**: You need to install the `aarch64-linux-gnu-gcc` package to cross compile the + Rust components to ARM from x86_64. You will also need to use `rustup` to add a new + target: `rustup target add aarch64-unknown-linux-gnu` ## Setting up an IDE @@ -16,9 +20,12 @@ If you don't have another preference, the recommendation is to download and inst (possibly through the JetBrains Toolbox, if you have it already). The recommended plugins to improve the DX are: - [Compose Multiplatform IDE Support](https://plugins.jetbrains.com/plugin/16541-compose-multiplatform-ide-support) -- [Rust Plugin](https://plugins.jetbrains.com/plugin/8182-rust) (deprecated due to [RustRover IDE](https://blog.jetbrains.com/rust/2023/09/13/introducing-rustrover-a-standalone-rust-ide-by-jetbrains/) but still works). +- [Rust Plugin](https://plugins.jetbrains.com/plugin/8182-rust) (deprecated due + to [RustRover IDE](https://blog.jetbrains.com/rust/2023/09/13/introducing-rustrover-a-standalone-rust-ide-by-jetbrains/) + but still works). -By default, the JDK used by "IntelliJ IDEA Community Edition (2023.1.3)" is "JetBrains Runtime version 21" which is not currently supported by the project. +By default, the JDK used by "IntelliJ IDEA Community Edition (2023.1.3)" is "JetBrains Runtime version 21" which is not +currently supported by the project. ## Alternative: Setting up JDK for use on CLI @@ -32,7 +39,8 @@ sudo apt install openjdk-17-jre openjdk-17-jdk export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 ``` -Once it works (e.g. `./gradlew build`). On Linux, you may want to add that latter line to your `/etc/environment` or user-specific files such as `.profile` or `.bashrc`. +Once it works (e.g. `./gradlew build`). On Linux, you may want to add that latter line to your `/etc/environment` or +user-specific files such as `.profile` or `.bashrc`. ## Running the app / unit tests diff --git a/README.md b/README.md index d7579dab..ccbb17e6 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,9 @@ can use it nor relying on web technologies. Linux: - Available as Flatpak [here](https://flathub.org/apps/details/com.jetpackduba.Gitnuro) or by - running `flatpak install com.jetpackduba.Gitnuro` if you have Flatpak & Flathub already setup. - - If Flathub is not set up, you can add the source with the following command `flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo`. + running `flatpak install com.jetpackduba.Gitnuro` if you have Flatpak & Flathub already setup. + - If Flathub is not set up, you can add the source with the following + command `flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo`. - JAR file can be executed as a portable version (Requires JRE 17). Windows: @@ -139,6 +140,7 @@ it if it's a very requested feature but not for now. > Authentication has failed. What's wrong? Currently there are some limitations regarding this topic. Here are some known problematic setups: + - Multicast DNS remote URL (https://github.com/JetpackDuba/Gitnuro/issues/19) with this workaround (https://github.com/JetpackDuba/Gitnuro/issues/19#issuecomment-1374431720). - Self signed server certificate (https://github.com/JetpackDuba/Gitnuro/issues/48) diff --git a/rs/Cargo.toml b/rs/Cargo.toml index 99a96ccd..cd42c3bf 100644 --- a/rs/Cargo.toml +++ b/rs/Cargo.toml @@ -11,10 +11,10 @@ name = "gitnuro_rs" uniffi = { version = "0.25.0" } notify = "6.0.1" thiserror = "1.0.43" -libssh-rs = { version = "0.2.2", features = [ "vendored", "vendored-openssl" ] } +libssh-rs = { version = "0.2.2", features = ["vendored", "vendored-openssl"] } [build-dependencies] -uniffi = { version = "0.25.0", features = [ "build" ] } +uniffi = { version = "0.25.0", features = ["build"] } [[bin]] name = "uniffi-bindgen" diff --git a/rs/src/lib.rs b/rs/src/lib.rs index 563c11f5..4cb1470c 100644 --- a/rs/src/lib.rs +++ b/rs/src/lib.rs @@ -1,9 +1,10 @@ -mod ssh; -mod watch_directory; - -use watch_directory::{ * }; -use ssh::{ * }; #[allow(unused_imports)] // Needed to map it to the enum in the UDL file use libssh_rs::AuthStatus; +use ssh::{*}; +use watch_directory::{*}; + +mod ssh; +mod watch_directory; + uniffi::include_scaffolding!("gitnuro"); diff --git a/rs/src/ssh.rs b/rs/src/ssh.rs index e597482c..24308ecd 100644 --- a/rs/src/ssh.rs +++ b/rs/src/ssh.rs @@ -1,6 +1,7 @@ -use libssh_rs::{AuthStatus, PollStatus, SshOption}; +use std::io::Write; use std::sync::{Arc, RwLock}; -use std::io::{Write}; + +use libssh_rs::{AuthStatus, PollStatus, SshOption}; const ACCEPTED_SSH_TYPES: &str = "ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,rsa-sha2-512,rsa-sha2-256,ssh-dss"; @@ -63,6 +64,7 @@ pub struct Channel { } unsafe impl Send for Channel {} + unsafe impl Sync for Channel {} impl Channel { @@ -105,7 +107,7 @@ impl Channel { } } - pub fn read(&self, is_stderr: bool, len: u64) -> ReadResult { + pub fn read(&self, is_stderr: bool, len: u64) -> ReadResult { let ulen = len as usize; let channel = self.channel.write().unwrap(); diff --git a/rs/src/watch_directory.rs b/rs/src/watch_directory.rs index 0d6dea13..46330168 100644 --- a/rs/src/watch_directory.rs +++ b/rs/src/watch_directory.rs @@ -4,6 +4,7 @@ use std::fmt::Debug; use std::path::{Path, PathBuf}; use std::sync::mpsc::{channel, RecvTimeoutError}; use std::time::{Duration, SystemTime, UNIX_EPOCH}; + use notify::{Config, Error, ErrorKind, Event, RecommendedWatcher, RecursiveMode, Watcher}; const MIN_TIME_IN_MS_BETWEEN_REFRESHES: u128 = 500; diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/App.kt b/src/main/kotlin/com/jetpackduba/gitnuro/App.kt index b487b197..af58124f 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/App.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/App.kt @@ -2,7 +2,8 @@ package com.jetpackduba.gitnuro -import androidx.compose.foundation.* +import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.background import androidx.compose.foundation.layout.* import androidx.compose.foundation.text.LocalTextContextMenu import androidx.compose.material.MaterialTheme @@ -17,7 +18,9 @@ import androidx.compose.ui.unit.Density import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import androidx.compose.ui.window.* +import androidx.compose.ui.window.Window +import androidx.compose.ui.window.application +import androidx.compose.ui.window.rememberWindowState import com.jetpackduba.gitnuro.di.DaggerAppComponent import com.jetpackduba.gitnuro.extensions.preferenceValue import com.jetpackduba.gitnuro.extensions.toWindowPlacement @@ -44,7 +47,6 @@ import java.io.File import java.net.Authenticator import java.net.PasswordAuthentication import java.nio.file.Paths -import java.util.* import javax.inject.Inject diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/credentials/CredentialsCacheRepository.kt b/src/main/kotlin/com/jetpackduba/gitnuro/credentials/CredentialsCacheRepository.kt index f0fa3b27..3e6c6c87 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/credentials/CredentialsCacheRepository.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/credentials/CredentialsCacheRepository.kt @@ -15,6 +15,7 @@ private const val KEY_LENGTH = 16 class CredentialsCacheRepository @Inject constructor() { private val credentialsCached = mutableListOf() private val credentialsLock = Mutex(false) + // having a random key to encrypt the password may help in case of a memory dump attack private val encryptionKey = getRandomKey() diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/credentials/GSessionManager.kt b/src/main/kotlin/com/jetpackduba/gitnuro/credentials/GSessionManager.kt index c58e5a0c..07dbd002 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/credentials/GSessionManager.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/credentials/GSessionManager.kt @@ -19,7 +19,7 @@ class GSessionManager @Inject constructor( class MySessionFactory @Inject constructor( private val sessionProvider: Provider -) : SshSessionFactory(), CredentialsCache { +) : SshSessionFactory(), CredentialsCache { override fun getSession( uri: URIish, credentialsProvider: CredentialsProvider?, diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/credentials/HttpCredentialsProvider.kt b/src/main/kotlin/com/jetpackduba/gitnuro/credentials/HttpCredentialsProvider.kt index d432066c..d8e378d1 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/credentials/HttpCredentialsProvider.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/credentials/HttpCredentialsProvider.kt @@ -11,9 +11,7 @@ import org.eclipse.jgit.api.Git import org.eclipse.jgit.internal.JGitText import org.eclipse.jgit.lib.Config import org.eclipse.jgit.transport.CredentialItem -import org.eclipse.jgit.transport.CredentialItem.Password -import org.eclipse.jgit.transport.CredentialItem.Username -import org.eclipse.jgit.transport.CredentialItem.YesNoType +import org.eclipse.jgit.transport.CredentialItem.* import org.eclipse.jgit.transport.CredentialsProvider import org.eclipse.jgit.transport.URIish import java.io.* diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/di/TabComponent.kt b/src/main/kotlin/com/jetpackduba/gitnuro/di/TabComponent.kt index 33b59c00..64827114 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/di/TabComponent.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/di/TabComponent.kt @@ -1,7 +1,5 @@ package com.jetpackduba.gitnuro.di -import com.jetpackduba.gitnuro.di.modules.NetworkModule -import com.jetpackduba.gitnuro.di.modules.ShellModule import com.jetpackduba.gitnuro.di.modules.TabModule import com.jetpackduba.gitnuro.ui.components.TabInformation import dagger.Component diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/exceptions/FetchException.kt b/src/main/kotlin/com/jetpackduba/gitnuro/exceptions/FetchException.kt index 224ca486..3fa2403b 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/exceptions/FetchException.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/exceptions/FetchException.kt @@ -1,3 +1,3 @@ package com.jetpackduba.gitnuro.exceptions -class FetchException(msg: String): GitnuroException(msg) \ No newline at end of file +class FetchException(msg: String) : GitnuroException(msg) \ No newline at end of file diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/extensions/ModifierExtensions.kt b/src/main/kotlin/com/jetpackduba/gitnuro/extensions/ModifierExtensions.kt index 1fba4a34..b27a5b5a 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/extensions/ModifierExtensions.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/extensions/ModifierExtensions.kt @@ -1,7 +1,10 @@ package com.jetpackduba.gitnuro.extensions import androidx.compose.foundation.* -import androidx.compose.foundation.gestures.* +import androidx.compose.foundation.gestures.awaitEachGesture +import androidx.compose.foundation.gestures.awaitFirstDown +import androidx.compose.foundation.gestures.detectTapGestures +import androidx.compose.foundation.gestures.waitForUpOrCancellation import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.runtime.Composable import androidx.compose.runtime.remember @@ -95,17 +98,17 @@ fun Modifier.onDoubleClick( @Composable fun Modifier.onMiddleMouseButtonClick(key: Any = Unit, key2: Any = Unit, onClick: () -> Unit) = this.pointerInput(key, key2) { - while (true) { - val lastMouseEvent = awaitPointerEventScope { awaitFirstDownEvent() } - val mouseEvent = lastMouseEvent.awtEventOrNull + while (true) { + val lastMouseEvent = awaitPointerEventScope { awaitFirstDownEvent() } + val mouseEvent = lastMouseEvent.awtEventOrNull - if (mouseEvent != null) { - if (lastMouseEvent.button.isTertiary) { - onClick() - } + if (mouseEvent != null) { + if (lastMouseEvent.button.isTertiary) { + onClick() } } } + } @Composable private fun Modifier.hoverBackground(): Modifier { diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/git/RawFileManager.kt b/src/main/kotlin/com/jetpackduba/gitnuro/git/RawFileManager.kt index 16940b6f..c8315269 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/git/RawFileManager.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/git/RawFileManager.kt @@ -1,7 +1,7 @@ package com.jetpackduba.gitnuro.git -import com.jetpackduba.gitnuro.managers.TempFilesManager import com.jetpackduba.gitnuro.extensions.fileName +import com.jetpackduba.gitnuro.managers.TempFilesManager import org.eclipse.jgit.diff.ContentSource import org.eclipse.jgit.diff.DiffEntry import org.eclipse.jgit.diff.RawText diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/git/TaskEvent.kt b/src/main/kotlin/com/jetpackduba/gitnuro/git/TaskEvent.kt index 6c2568dc..a8be7963 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/git/TaskEvent.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/git/TaskEvent.kt @@ -1,7 +1,6 @@ package com.jetpackduba.gitnuro.git import com.jetpackduba.gitnuro.ui.SelectedItem -import org.eclipse.jgit.revwalk.RevCommit sealed interface TaskEvent { data class ScrollToGraphItem(val selectedItem: SelectedItem) : TaskEvent diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/git/branches/SetTrackingBranchUseCase.kt b/src/main/kotlin/com/jetpackduba/gitnuro/git/branches/SetTrackingBranchUseCase.kt index ff7e2dc8..b5a5fdba 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/git/branches/SetTrackingBranchUseCase.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/git/branches/SetTrackingBranchUseCase.kt @@ -2,7 +2,6 @@ package com.jetpackduba.gitnuro.git.branches import com.jetpackduba.gitnuro.extensions.simpleName import org.eclipse.jgit.api.Git -import org.eclipse.jgit.lib.Config import org.eclipse.jgit.lib.Ref import org.eclipse.jgit.lib.Repository import org.eclipse.jgit.lib.StoredConfig diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/git/config/LocalConfigConstants.kt b/src/main/kotlin/com/jetpackduba/gitnuro/git/config/LocalConfigConstants.kt index 7a379de0..52efb8a5 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/git/config/LocalConfigConstants.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/git/config/LocalConfigConstants.kt @@ -10,7 +10,8 @@ object LocalConfigConstants { const val DEFAULT_SIGN_OFF_FORMAT_USER = "%user" const val DEFAULT_SIGN_OFF_FORMAT_EMAIL = "%email" - const val DEFAULT_SIGN_OFF_FORMAT = "Signed-off-by: $DEFAULT_SIGN_OFF_FORMAT_USER <$DEFAULT_SIGN_OFF_FORMAT_EMAIL>" + const val DEFAULT_SIGN_OFF_FORMAT = + "Signed-off-by: $DEFAULT_SIGN_OFF_FORMAT_USER <$DEFAULT_SIGN_OFF_FORMAT_EMAIL>" const val DEFAULT_SIGN_OFF_ENABLED = false } } \ No newline at end of file diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/git/diff/DiffResult.kt b/src/main/kotlin/com/jetpackduba/gitnuro/git/diff/DiffResult.kt index 8014b678..c42b47f4 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/git/diff/DiffResult.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/git/diff/DiffResult.kt @@ -7,7 +7,7 @@ import org.eclipse.jgit.submodule.SubmoduleStatus sealed class DiffResult( val diffEntry: DiffEntry, ) { - sealed class TextDiff(diffEntry: DiffEntry): DiffResult(diffEntry) + sealed class TextDiff(diffEntry: DiffEntry) : DiffResult(diffEntry) class Text( diffEntry: DiffEntry, diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/git/log/GetLogUseCase.kt b/src/main/kotlin/com/jetpackduba/gitnuro/git/log/GetLogUseCase.kt index 44b02b3a..ee334f88 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/git/log/GetLogUseCase.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/git/log/GetLogUseCase.kt @@ -54,7 +54,7 @@ class GetLogUseCase @Inject constructor() { private fun cachedGraphWalk(repository: Repository): GraphWalk { val graphWalkCached = this.graphWalkCached - return if(graphWalkCached != null) { + return if (graphWalkCached != null) { graphWalkCached } else { val newGraphWalk = GraphWalk(repository) diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/git/rebase/GetRebaseInteractiveStateUseCase.kt b/src/main/kotlin/com/jetpackduba/gitnuro/git/rebase/GetRebaseInteractiveStateUseCase.kt index 5eae9a37..9f48531d 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/git/rebase/GetRebaseInteractiveStateUseCase.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/git/rebase/GetRebaseInteractiveStateUseCase.kt @@ -23,6 +23,7 @@ class GetRebaseInteractiveStateUseCase @Inject constructor( RebaseInteractiveState.ProcessingCommits(commitId) } + else -> RebaseInteractiveState.AwaitingInteraction } } diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/git/remote_operations/FetchAllBranchesUseCase.kt b/src/main/kotlin/com/jetpackduba/gitnuro/git/remote_operations/FetchAllBranchesUseCase.kt index 20a02150..3e8f376c 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/git/remote_operations/FetchAllBranchesUseCase.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/git/remote_operations/FetchAllBranchesUseCase.kt @@ -1,7 +1,6 @@ package com.jetpackduba.gitnuro.git.remote_operations import com.jetpackduba.gitnuro.exceptions.FetchException -import com.jetpackduba.gitnuro.exceptions.GitnuroException import com.jetpackduba.gitnuro.logging.printError import kotlinx.coroutines.CancellationException import kotlinx.coroutines.Dispatchers @@ -48,13 +47,13 @@ class FetchAllBranchesUseCase @Inject constructor( } catch (ex: Exception) { printError(TAG, "Fetch failed for remote ${remote.name} with error ${ex.message}", ex) - if(ex.message != "Cancelled authentication" && ex !is CancellationException) { - errors.add(remote to ex) + if (ex.message != "Cancelled authentication" && ex !is CancellationException) { + errors.add(remote to ex) } } } - if(errors.isNotEmpty()) { + if (errors.isNotEmpty()) { val errorText = errors.joinToString("\n") { "Fetch failed for remote ${it.first.name}: ${it.second.message}" } diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/git/remote_operations/HandleTransportUseCase.kt b/src/main/kotlin/com/jetpackduba/gitnuro/git/remote_operations/HandleTransportUseCase.kt index bb6f5586..c5da6683 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/git/remote_operations/HandleTransportUseCase.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/git/remote_operations/HandleTransportUseCase.kt @@ -15,7 +15,7 @@ class HandleTransportUseCase @Inject constructor( suspend operator fun invoke(git: Git?, block: suspend CredentialsHandler.() -> Unit) { var cache: CredentialsCache? = null - val credentialsHandler = object: CredentialsHandler { + val credentialsHandler = object : CredentialsHandler { override fun handleTransport(transport: Transport?) { cache = when (transport) { is SshTransport -> { @@ -41,6 +41,7 @@ class HandleTransportUseCase @Inject constructor( cache?.cacheCredentialsIfNeeded() } } + interface CredentialsCache { suspend fun cacheCredentialsIfNeeded() } diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/git/remote_operations/PullBranchUseCase.kt b/src/main/kotlin/com/jetpackduba/gitnuro/git/remote_operations/PullBranchUseCase.kt index 6ccbb8ed..65115d0b 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/git/remote_operations/PullBranchUseCase.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/git/remote_operations/PullBranchUseCase.kt @@ -4,7 +4,6 @@ import com.jetpackduba.gitnuro.preferences.AppSettings import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import org.eclipse.jgit.api.Git -import org.eclipse.jgit.api.PullResult import org.eclipse.jgit.api.RebaseResult import org.eclipse.jgit.transport.CredentialsProvider import javax.inject.Inject @@ -23,7 +22,7 @@ class PullBranchUseCase @Inject constructor( handleTransportUseCase(git) { val pullResult = git .pull() - .setTransportConfigCallback {this.handleTransport(it) } + .setTransportConfigCallback { this.handleTransport(it) } .setRebase(pullWithRebase) .setCredentialsProvider(CredentialsProvider.getDefault()) .call() diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/git/repository/OpenSubmoduleRepositoryUseCase.kt b/src/main/kotlin/com/jetpackduba/gitnuro/git/repository/OpenSubmoduleRepositoryUseCase.kt index ab4f4997..c932abf9 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/git/repository/OpenSubmoduleRepositoryUseCase.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/git/repository/OpenSubmoduleRepositoryUseCase.kt @@ -18,7 +18,8 @@ class OpenSubmoduleRepositoryUseCase @Inject constructor( val repository = openRepositoryUseCase(parent) - val submoduleRelativePath = directory.absolutePath.removePrefix("${repository.directory.parent}$systemSeparator") + val submoduleRelativePath = + directory.absolutePath.removePrefix("${repository.directory.parent}$systemSeparator") return@withContext SubmoduleWalk.getSubmoduleRepository(repository, submoduleRelativePath) ?: throw InvalidDirectoryException("Invalid submodule directory. Check if the submodule has been initialized before trying to open it.") diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/git/submodules/DeleteSubmoduleUseCase.kt b/src/main/kotlin/com/jetpackduba/gitnuro/git/submodules/DeleteSubmoduleUseCase.kt index 983fb626..6ae75bbd 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/git/submodules/DeleteSubmoduleUseCase.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/git/submodules/DeleteSubmoduleUseCase.kt @@ -3,7 +3,6 @@ package com.jetpackduba.gitnuro.git.submodules import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import org.eclipse.jgit.api.Git -import org.eclipse.jgit.lib.Config import org.eclipse.jgit.storage.file.FileBasedConfig import java.io.File import javax.inject.Inject diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/git/workspace/DoCommitUseCase.kt b/src/main/kotlin/com/jetpackduba/gitnuro/git/workspace/DoCommitUseCase.kt index 33c9dca0..cd513868 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/git/workspace/DoCommitUseCase.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/git/workspace/DoCommitUseCase.kt @@ -25,7 +25,7 @@ class DoCommitUseCase @Inject constructor( ): RevCommit = withContext(Dispatchers.IO) { val signOffConfig = loadSignOffConfigUseCase(git.repository) - val finalMessage = if(signOffConfig.isEnabled) { + val finalMessage = if (signOffConfig.isEnabled) { val authorToSign = author ?: loadAuthorUseCase(git).toPersonIdent() val signature = signOffConfig.format diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/git/workspace/ResetHunkUseCase.kt b/src/main/kotlin/com/jetpackduba/gitnuro/git/workspace/ResetHunkUseCase.kt index 94f9b24c..dd12ea73 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/git/workspace/ResetHunkUseCase.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/git/workspace/ResetHunkUseCase.kt @@ -1,6 +1,5 @@ package com.jetpackduba.gitnuro.git.workspace -import com.jetpackduba.gitnuro.extensions.lineDelimiter import com.jetpackduba.gitnuro.git.diff.Hunk import com.jetpackduba.gitnuro.git.diff.LineType import kotlinx.coroutines.Dispatchers diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/managers/AppFilesManager.kt b/src/main/kotlin/com/jetpackduba/gitnuro/managers/AppFilesManager.kt index 51330439..bb1be9b8 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/managers/AppFilesManager.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/managers/AppFilesManager.kt @@ -1,8 +1,8 @@ package com.jetpackduba.gitnuro.managers +import com.jetpackduba.gitnuro.logging.printError import com.jetpackduba.gitnuro.system.OS import com.jetpackduba.gitnuro.system.currentOs -import com.jetpackduba.gitnuro.logging.printError import java.io.File import javax.inject.Inject diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/managers/TempFilesManager.kt b/src/main/kotlin/com/jetpackduba/gitnuro/managers/TempFilesManager.kt index 87f84d24..c7a445cf 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/managers/TempFilesManager.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/managers/TempFilesManager.kt @@ -1,6 +1,5 @@ package com.jetpackduba.gitnuro.managers -import com.jetpackduba.gitnuro.di.TabScope import com.jetpackduba.gitnuro.extensions.openDirectory import java.io.File import javax.inject.Inject diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/models/ProgressMonitorInfo.kt b/src/main/kotlin/com/jetpackduba/gitnuro/models/ProgressMonitorInfo.kt index 6c02c393..0052c0d9 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/models/ProgressMonitorInfo.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/models/ProgressMonitorInfo.kt @@ -1,9 +1,5 @@ package com.jetpackduba.gitnuro.models -import kotlinx.coroutines.flow.SharedFlow -import kotlinx.coroutines.withContext -import org.eclipse.jgit.lib.ProgressMonitor - sealed interface ProgressMonitorInfo { object Loading : ProgressMonitorInfo diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/system/OpenFilePickerUseCase.kt b/src/main/kotlin/com/jetpackduba/gitnuro/system/OpenFilePickerUseCase.kt index c7a4b709..589ee1c5 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/system/OpenFilePickerUseCase.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/system/OpenFilePickerUseCase.kt @@ -40,7 +40,12 @@ class OpenFilePickerUseCase @Inject constructor( if (isZenityInstalled) { val command = when (pickerType) { - PickerType.FILES, PickerType.FILES_AND_DIRECTORIES -> listOf("zenity", "--file-selection", "--title=Open") + PickerType.FILES, PickerType.FILES_AND_DIRECTORIES -> listOf( + "zenity", + "--file-selection", + "--title=Open" + ) + PickerType.DIRECTORIES -> listOf("zenity", "--file-selection", "--title=Open", "--directory") } diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/terminal/MacTerminalProvider.kt b/src/main/kotlin/com/jetpackduba/gitnuro/terminal/MacTerminalProvider.kt index a303c94c..c0277080 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/terminal/MacTerminalProvider.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/terminal/MacTerminalProvider.kt @@ -19,6 +19,9 @@ class MacTerminalProvider @Inject constructor( override fun startTerminal(terminalEmulator: TerminalEmulator, repositoryPath: String) { // TODO Check if passing the path as argument is required for other terminal emulators - shellManager.runCommandInPath(listOf("open", "-a", terminalEmulator.path, "-n", "--args", repositoryPath), repositoryPath) + shellManager.runCommandInPath( + listOf("open", "-a", terminalEmulator.path, "-n", "--args", repositoryPath), + repositoryPath + ) } } \ No newline at end of file diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/terminal/WindowsTerminalProvider.kt b/src/main/kotlin/com/jetpackduba/gitnuro/terminal/WindowsTerminalProvider.kt index 6487adf5..3d14b535 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/terminal/WindowsTerminalProvider.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/terminal/WindowsTerminalProvider.kt @@ -1,7 +1,6 @@ package com.jetpackduba.gitnuro.terminal import com.jetpackduba.gitnuro.managers.IShellManager -import java.io.File import javax.inject.Inject class WindowsTerminalProvider @Inject constructor( diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/ui/Blame.kt b/src/main/kotlin/com/jetpackduba/gitnuro/ui/Blame.kt index 928a913a..eab313b7 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/ui/Blame.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/ui/Blame.kt @@ -27,7 +27,9 @@ import androidx.compose.ui.input.key.type import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp import com.jetpackduba.gitnuro.AppIcons -import com.jetpackduba.gitnuro.extensions.* +import com.jetpackduba.gitnuro.extensions.handOnHover +import com.jetpackduba.gitnuro.extensions.lineAt +import com.jetpackduba.gitnuro.extensions.toStringWithSpaces import com.jetpackduba.gitnuro.keybindings.KeybindingOption import com.jetpackduba.gitnuro.keybindings.matchesBinding import com.jetpackduba.gitnuro.theme.notoSansMonoFontFamily diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/ui/CommitChanges.kt b/src/main/kotlin/com/jetpackduba/gitnuro/ui/CommitChanges.kt index 293eb683..3a4be81f 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/ui/CommitChanges.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/ui/CommitChanges.kt @@ -1,11 +1,14 @@ package com.jetpackduba.gitnuro.ui -import androidx.compose.foundation.* +import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.ScrollState +import androidx.compose.foundation.background import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.selection.SelectionContainer +import androidx.compose.foundation.verticalScroll import androidx.compose.material.* import androidx.compose.runtime.* import androidx.compose.ui.Alignment @@ -23,7 +26,9 @@ import androidx.compose.ui.unit.dp import com.jetpackduba.gitnuro.AppIcons import com.jetpackduba.gitnuro.extensions.* import com.jetpackduba.gitnuro.git.DiffEntryType -import com.jetpackduba.gitnuro.theme.* +import com.jetpackduba.gitnuro.theme.backgroundSelected +import com.jetpackduba.gitnuro.theme.onBackgroundSecondary +import com.jetpackduba.gitnuro.theme.tertiarySurface import com.jetpackduba.gitnuro.ui.components.* import com.jetpackduba.gitnuro.ui.context_menu.ContextMenu import com.jetpackduba.gitnuro.ui.context_menu.committedChangesEntriesContextMenuItems diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/ui/components/FilterDropdown.kt b/src/main/kotlin/com/jetpackduba/gitnuro/ui/components/FilterDropdown.kt index 045b50d0..19a65f43 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/ui/components/FilterDropdown.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/ui/components/FilterDropdown.kt @@ -21,10 +21,10 @@ import com.jetpackduba.gitnuro.ui.dropdowns.DropDownOption @Composable fun FilterDropdownPreview() { val items = listOf( - DropDownOption("","Test1"), - DropDownOption("","Test2"), - DropDownOption("","Test3"), - DropDownOption("","Test4"), + DropDownOption("", "Test1"), + DropDownOption("", "Test2"), + DropDownOption("", "Test3"), + DropDownOption("", "Test4"), ) FilterDropdown( @@ -44,7 +44,8 @@ fun FilterDropdown( var showDropdown by remember { mutableStateOf(false) } var filter by remember { mutableStateOf("") } val filterFocusRequester = remember { FocusRequester() } - val filteredDropdownItems = remember(filter, dropdownItems) { dropdownItems.filter { it.optionName.lowercaseContains(filter) } } + val filteredDropdownItems = + remember(filter, dropdownItems) { dropdownItems.filter { it.optionName.lowercaseContains(filter) } } Box { OutlinedButton( diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/ui/components/RepositoriesTabPanel.kt b/src/main/kotlin/com/jetpackduba/gitnuro/ui/components/RepositoriesTabPanel.kt index 762dc4c9..fa5b3af2 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/ui/components/RepositoriesTabPanel.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/ui/components/RepositoriesTabPanel.kt @@ -8,7 +8,10 @@ import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.v2.maxScrollOffset -import androidx.compose.material.* +import androidx.compose.material.Icon +import androidx.compose.material.IconButton +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Add import androidx.compose.runtime.* @@ -19,7 +22,8 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import com.jetpackduba.gitnuro.* +import com.jetpackduba.gitnuro.AppIcons +import com.jetpackduba.gitnuro.LocalTabScope import com.jetpackduba.gitnuro.di.AppComponent import com.jetpackduba.gitnuro.di.DaggerTabComponent import com.jetpackduba.gitnuro.di.TabComponent diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/ui/components/SideMenuSubentry.kt b/src/main/kotlin/com/jetpackduba/gitnuro/ui/components/SideMenuSubentry.kt index 70c91a34..fe53cb23 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/ui/components/SideMenuSubentry.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/ui/components/SideMenuSubentry.kt @@ -2,7 +2,8 @@ package com.jetpackduba.gitnuro.ui.components -import androidx.compose.foundation.* +import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.* import androidx.compose.material.Icon import androidx.compose.material.MaterialTheme diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/ui/components/TextLink.kt b/src/main/kotlin/com/jetpackduba/gitnuro/ui/components/TextLink.kt index 89cd352c..f7642ecb 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/ui/components/TextLink.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/ui/components/TextLink.kt @@ -4,7 +4,6 @@ import androidx.compose.foundation.hoverable import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.interaction.collectIsHoveredAsState import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.remember diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/ui/context_menu/BranchContextMenu.kt b/src/main/kotlin/com/jetpackduba/gitnuro/ui/context_menu/BranchContextMenu.kt index 55d0967b..96384dab 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/ui/context_menu/BranchContextMenu.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/ui/context_menu/BranchContextMenu.kt @@ -61,7 +61,7 @@ fun branchContextMenuItems( ) } - if(isLocal) { + if (isLocal) { add( ContextMenuElement.ContextTextEntry( label = "Change default upstream branch", diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/ui/context_menu/ContextMenu.kt b/src/main/kotlin/com/jetpackduba/gitnuro/ui/context_menu/ContextMenu.kt index a989d400..e64b50b3 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/ui/context_menu/ContextMenu.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/ui/context_menu/ContextMenu.kt @@ -24,7 +24,8 @@ import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.input.InputMode import androidx.compose.ui.input.InputModeManager import androidx.compose.ui.input.key.* -import androidx.compose.ui.input.pointer.* +import androidx.compose.ui.input.pointer.isSecondary +import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.layout.onGloballyPositioned import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.platform.LocalInputModeManager diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/ui/context_menu/SubmoduleContextMenu.kt b/src/main/kotlin/com/jetpackduba/gitnuro/ui/context_menu/SubmoduleContextMenu.kt index 5455e9ae..685f1220 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/ui/context_menu/SubmoduleContextMenu.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/ui/context_menu/SubmoduleContextMenu.kt @@ -56,7 +56,7 @@ fun submoduleContextMenuItems( // ) } - if(isNotEmpty()) { + if (isNotEmpty()) { add( ContextMenuElement.ContextSeparator, ) diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/ui/dialogs/AddSubmoduleDialog.kt b/src/main/kotlin/com/jetpackduba/gitnuro/ui/dialogs/AddSubmoduleDialog.kt index 2c72cc69..e726229c 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/ui/dialogs/AddSubmoduleDialog.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/ui/dialogs/AddSubmoduleDialog.kt @@ -148,7 +148,7 @@ fun AddSubmodulesDialog( }, ) - AnimatedVisibility (error.isNotBlank()) { + AnimatedVisibility(error.isNotBlank()) { Box( modifier = Modifier .fillMaxWidth() diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/ui/dialogs/ResetDialog.kt b/src/main/kotlin/com/jetpackduba/gitnuro/ui/dialogs/ResetDialog.kt index f4615aae..8abbcb7d 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/ui/dialogs/ResetDialog.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/ui/dialogs/ResetDialog.kt @@ -7,7 +7,9 @@ import androidx.compose.foundation.layout.* import androidx.compose.foundation.onClick import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material.* +import androidx.compose.material.Icon +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Text import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/ui/dialogs/SetDefaultUpstreamBranchDialog.kt b/src/main/kotlin/com/jetpackduba/gitnuro/ui/dialogs/SetDefaultUpstreamBranchDialog.kt index 6a50b89d..2822393a 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/ui/dialogs/SetDefaultUpstreamBranchDialog.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/ui/dialogs/SetDefaultUpstreamBranchDialog.kt @@ -5,7 +5,10 @@ import androidx.compose.foundation.layout.* import androidx.compose.material.Icon import androidx.compose.material.MaterialTheme import androidx.compose.material.Text -import androidx.compose.runtime.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/updates/UpdatesRepository.kt b/src/main/kotlin/com/jetpackduba/gitnuro/updates/UpdatesRepository.kt index 7f25ad6e..be29e95b 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/updates/UpdatesRepository.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/updates/UpdatesRepository.kt @@ -22,7 +22,7 @@ class UpdatesRepository @Inject constructor( fun hasUpdatesFlow() = flow { val latestReleaseJson = updatesWebService.release(AppConstants.VERSION_CHECK_URL) - while(coroutineContext.isActive) { + while (coroutineContext.isActive) { val update = updateJson.decodeFromString(latestReleaseJson) if (update != null && update.appCode > AppConstants.APP_VERSION_CODE) { diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/CommitChangesViewModel.kt b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/CommitChangesViewModel.kt index 81f262af..86da38d7 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/CommitChangesViewModel.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/CommitChangesViewModel.kt @@ -86,7 +86,7 @@ class CommitChangesViewModel @Inject constructor( if (untrackedFilesCommit != null) { val untrackedFilesChanges = getCommitDiffEntriesUseCase(git, untrackedFilesCommit) - if(untrackedFilesChanges.all { it.changeType == DiffEntry.ChangeType.ADD }) { // All files should be new + if (untrackedFilesChanges.all { it.changeType == DiffEntry.ChangeType.ADD }) { // All files should be new changes.addAll(untrackedFilesChanges) } } diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/DiffViewModel.kt b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/DiffViewModel.kt index 11fa94c9..ec340a37 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/DiffViewModel.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/DiffViewModel.kt @@ -54,22 +54,22 @@ class DiffViewModel @Inject constructor( diffTypeFlow .drop(1) // Ignore the first time the flow triggers, we only care about updates .collect { - val diffEntryType = this@DiffViewModel.diffEntryType - if (diffEntryType != null) { - updateDiff(diffEntryType) + val diffEntryType = this@DiffViewModel.diffEntryType + if (diffEntryType != null) { + updateDiff(diffEntryType) + } } - } } tabScope.launch { isDisplayFullFile .drop(1) // Ignore the first time the flow triggers, we only care about updates .collect { - val diffEntryType = this@DiffViewModel.diffEntryType - if (diffEntryType != null) { - updateDiff(diffEntryType) + val diffEntryType = this@DiffViewModel.diffEntryType + if (diffEntryType != null) { + updateDiff(diffEntryType) + } } - } } tabScope.launch { diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/HistoryViewModel.kt b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/HistoryViewModel.kt index 6edff4a9..888e5d58 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/HistoryViewModel.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/HistoryViewModel.kt @@ -108,7 +108,11 @@ class HistoryViewModel @Inject constructor( val diffEntryType = DiffEntryType.CommitDiff(diffEntry) - val diffResult = formatDiffUseCase(git, diffEntryType, false) // TODO This hardcoded false should be changed when the UI is implemented + val diffResult = formatDiffUseCase( + git, + diffEntryType, + false + ) // TODO This hardcoded false should be changed when the UI is implemented val textDiffType = settings.textDiffType val formattedDiffResult = if (textDiffType == TextDiffType.SPLIT && diffResult is DiffResult.Text) { diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/LogViewModel.kt b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/LogViewModel.kt index 8aa2255c..338803c6 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/LogViewModel.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/LogViewModel.kt @@ -71,7 +71,7 @@ class LogViewModel @Inject constructor( private val appSettings: AppSettings, private val tabScope: CoroutineScope, private val sharedStashViewModel: SharedStashViewModel, -) : ViewModel, ISharedStashViewModel by sharedStashViewModel { +) : ViewModel, ISharedStashViewModel by sharedStashViewModel { private val _logStatus = MutableStateFlow(LogStatus.Loading) val logStatus: StateFlow diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/SettingsViewModel.kt b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/SettingsViewModel.kt index 7799f224..7171c96c 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/SettingsViewModel.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/SettingsViewModel.kt @@ -140,7 +140,11 @@ class SettingsViewModel @Inject constructor( null } catch (ex: Exception) { ex.printStackTrace() - newErrorNow(ex, "Saving theme failed", "Failed to parse selected theme JSON. Please check if it's valid and try again.") + newErrorNow( + ex, + "Saving theme failed", + "Failed to parse selected theme JSON. Please check if it's valid and try again." + ) } } diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/StatusViewModel.kt b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/StatusViewModel.kt index eb4b2442..8188e6b0 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/StatusViewModel.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/StatusViewModel.kt @@ -11,11 +11,12 @@ import com.jetpackduba.gitnuro.git.RefreshType import com.jetpackduba.gitnuro.git.TabState import com.jetpackduba.gitnuro.git.author.LoadAuthorUseCase import com.jetpackduba.gitnuro.git.author.SaveAuthorUseCase -import com.jetpackduba.gitnuro.git.log.CheckHasPreviousCommitsUseCase import com.jetpackduba.gitnuro.git.log.GetLastCommitMessageUseCase import com.jetpackduba.gitnuro.git.log.GetSpecificCommitMessageUseCase -import com.jetpackduba.gitnuro.git.rebase.* -import com.jetpackduba.gitnuro.git.repository.GetRepositoryStateUseCase +import com.jetpackduba.gitnuro.git.rebase.AbortRebaseUseCase +import com.jetpackduba.gitnuro.git.rebase.ContinueRebaseUseCase +import com.jetpackduba.gitnuro.git.rebase.RebaseInteractiveState +import com.jetpackduba.gitnuro.git.rebase.SkipRebaseUseCase import com.jetpackduba.gitnuro.git.repository.ResetRepositoryStateUseCase import com.jetpackduba.gitnuro.git.workspace.* import com.jetpackduba.gitnuro.models.AuthorInfo diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/TabViewModel.kt b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/TabViewModel.kt index 2938c376..44bee41d 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/TabViewModel.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/TabViewModel.kt @@ -201,6 +201,7 @@ class TabViewModel @Inject constructor( _showAuthorInfo.value = false authorViewModel = null } + /** * Sometimes external apps can run filesystem multiple operations in a fraction of a second. * To prevent excessive updates, we add a slight delay between updates emission to prevent slowing down diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/TabViewModelsHolder.kt b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/TabViewModelsHolder.kt index be0eb246..c517cacb 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/TabViewModelsHolder.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/TabViewModelsHolder.kt @@ -24,7 +24,7 @@ class TabViewModelsHolder @Inject constructor( private val changeDefaultUpstreamBranchViewModelProvider: Provider, private val submoduleDialogViewModelProvider: Provider, private val signOffDialogViewModelProvider: Provider, - ) { +) { val viewModels = mapOf( logViewModel::class to logViewModel, sidePanelViewModel::class to sidePanelViewModel, @@ -38,7 +38,7 @@ class TabViewModelsHolder @Inject constructor( // TODO Call this when required fun dynamicViewModel(type: KClass<*>): Any { - return when(type) { + return when (type) { DiffViewModel::class -> diffViewModelProvider.get() HistoryViewModel::class -> historyViewModelProvider.get() AuthorViewModel::class -> authorViewModelProvider.get() diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/sidepanel/StashesViewModel.kt b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/sidepanel/StashesViewModel.kt index 563a2f42..ef5f4864 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/sidepanel/StashesViewModel.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/sidepanel/StashesViewModel.kt @@ -9,7 +9,6 @@ import com.jetpackduba.gitnuro.viewmodels.SharedStashViewModel import dagger.assisted.Assisted import dagger.assisted.AssistedInject import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Job import kotlinx.coroutines.flow.* import kotlinx.coroutines.launch import org.eclipse.jgit.api.Git diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/sidepanel/SubmoduleDialogViewModel.kt b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/sidepanel/SubmoduleDialogViewModel.kt index 37fb8866..fdfb3131 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/sidepanel/SubmoduleDialogViewModel.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/sidepanel/SubmoduleDialogViewModel.kt @@ -2,8 +2,10 @@ package com.jetpackduba.gitnuro.viewmodels.sidepanel import com.jetpackduba.gitnuro.git.RefreshType import com.jetpackduba.gitnuro.git.TabState -import dagger.assisted.AssistedInject -import kotlinx.coroutines.flow.* +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.asSharedFlow +import kotlinx.coroutines.flow.asStateFlow import org.eclipse.jgit.transport.URIish import java.io.File import javax.inject.Inject diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/sidepanel/SubmodulesViewModel.kt b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/sidepanel/SubmodulesViewModel.kt index 83a045d1..1bf600ce 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/sidepanel/SubmodulesViewModel.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/sidepanel/SubmodulesViewModel.kt @@ -43,7 +43,11 @@ class SubmodulesViewModel @AssistedInject constructor( init { tabScope.launch { - tabState.refreshFlowFiltered(RefreshType.ALL_DATA, RefreshType.UNCOMMITTED_CHANGES, RefreshType.SUBMODULES) { + tabState.refreshFlowFiltered( + RefreshType.ALL_DATA, + RefreshType.UNCOMMITTED_CHANGES, + RefreshType.SUBMODULES + ) { refresh(tabState.git) } } diff --git a/src/main/resources/copy.svg b/src/main/resources/copy.svg index 31873cb4..138ffb06 100644 --- a/src/main/resources/copy.svg +++ b/src/main/resources/copy.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + \ No newline at end of file diff --git a/src/main/resources/cut.svg b/src/main/resources/cut.svg index 561870a2..699e153b 100644 --- a/src/main/resources/cut.svg +++ b/src/main/resources/cut.svg @@ -1 +1,7 @@ - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/src/main/resources/description.svg b/src/main/resources/description.svg index 8b444aa5..6ab9b50e 100644 --- a/src/main/resources/description.svg +++ b/src/main/resources/description.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + \ No newline at end of file diff --git a/src/main/resources/done.svg b/src/main/resources/done.svg index 8e859e5b..19b65886 100644 --- a/src/main/resources/done.svg +++ b/src/main/resources/done.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + \ No newline at end of file diff --git a/src/main/resources/drag.svg b/src/main/resources/drag.svg index f3f8364c..6dc149d8 100644 --- a/src/main/resources/drag.svg +++ b/src/main/resources/drag.svg @@ -1 +1,3 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/src/main/resources/horizontal_split.svg b/src/main/resources/horizontal_split.svg index 1fd78243..b5ea4cdf 100644 --- a/src/main/resources/horizontal_split.svg +++ b/src/main/resources/horizontal_split.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + \ No newline at end of file diff --git a/src/main/resources/layout.svg b/src/main/resources/layout.svg index 13de854a..64098b69 100644 --- a/src/main/resources/layout.svg +++ b/src/main/resources/layout.svg @@ -1 +1,5 @@ - \ No newline at end of file + + + + \ No newline at end of file diff --git a/src/main/resources/list.svg b/src/main/resources/list.svg index b49cf9c6..0466dfa6 100644 --- a/src/main/resources/list.svg +++ b/src/main/resources/list.svg @@ -1 +1,7 @@ - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/src/main/resources/network.svg b/src/main/resources/network.svg index b4dbf0ce..6a9dde7b 100644 --- a/src/main/resources/network.svg +++ b/src/main/resources/network.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + \ No newline at end of file diff --git a/src/main/resources/palette.svg b/src/main/resources/palette.svg index d9cfd7a0..1e90a42f 100644 --- a/src/main/resources/palette.svg +++ b/src/main/resources/palette.svg @@ -1 +1,19 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/password.svg b/src/main/resources/password.svg index 6cb7fad7..259c989e 100644 --- a/src/main/resources/password.svg +++ b/src/main/resources/password.svg @@ -1 +1,3 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/src/main/resources/paste.svg b/src/main/resources/paste.svg index b1134e02..5f75b18d 100644 --- a/src/main/resources/paste.svg +++ b/src/main/resources/paste.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + \ No newline at end of file diff --git a/src/main/resources/remove_done.svg b/src/main/resources/remove_done.svg index 9e4c8179..28a5840c 100644 --- a/src/main/resources/remove_done.svg +++ b/src/main/resources/remove_done.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + \ No newline at end of file diff --git a/src/main/resources/security.svg b/src/main/resources/security.svg index ecb1f583..d319da73 100644 --- a/src/main/resources/security.svg +++ b/src/main/resources/security.svg @@ -1 +1,3 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/src/main/resources/sign.svg b/src/main/resources/sign.svg index def954e2..3c67d900 100644 --- a/src/main/resources/sign.svg +++ b/src/main/resources/sign.svg @@ -1 +1,13 @@ - \ No newline at end of file + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/sync.svg b/src/main/resources/sync.svg index 7e10ba16..9f5a3f17 100644 --- a/src/main/resources/sync.svg +++ b/src/main/resources/sync.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + \ No newline at end of file diff --git a/src/main/resources/unified.svg b/src/main/resources/unified.svg index 293124b2..a8bdddc1 100644 --- a/src/main/resources/unified.svg +++ b/src/main/resources/unified.svg @@ -1,10 +1,10 @@ - - - - - - - - + + + + + + + + diff --git a/src/main/resources/update.svg b/src/main/resources/update.svg index fe049271..a89d8ea5 100644 --- a/src/main/resources/update.svg +++ b/src/main/resources/update.svg @@ -1 +1,13 @@ - \ No newline at end of file + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/vertical_split.svg b/src/main/resources/vertical_split.svg index 18bb8a03..3438a7d9 100644 --- a/src/main/resources/vertical_split.svg +++ b/src/main/resources/vertical_split.svg @@ -1,11 +1,11 @@ - - - - - - - - - + + + + + + + + + diff --git a/src/main/resources/visibility.svg b/src/main/resources/visibility.svg index ca40f728..cf32cd2f 100644 --- a/src/main/resources/visibility.svg +++ b/src/main/resources/visibility.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + \ No newline at end of file diff --git a/src/main/resources/visibility_off.svg b/src/main/resources/visibility_off.svg index 396cb2a6..c4e95fa1 100644 --- a/src/main/resources/visibility_off.svg +++ b/src/main/resources/visibility_off.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + \ No newline at end of file diff --git a/src/test/kotlin/com/jetpackduba/gitnuro/git/branches/CheckoutRefUseCaseTest.kt b/src/test/kotlin/com/jetpackduba/gitnuro/git/branches/CheckoutRefUseCaseTest.kt index ca9c5ce2..9a13757a 100644 --- a/src/test/kotlin/com/jetpackduba/gitnuro/git/branches/CheckoutRefUseCaseTest.kt +++ b/src/test/kotlin/com/jetpackduba/gitnuro/git/branches/CheckoutRefUseCaseTest.kt @@ -1,14 +1,13 @@ package com.jetpackduba.gitnuro.git.branches -import com.jetpackduba.gitnuro.extensions.isBranch -import com.jetpackduba.gitnuro.extensions.simpleName -import io.mockk.* +import io.mockk.every +import io.mockk.mockk +import io.mockk.verify import kotlinx.coroutines.runBlocking import org.eclipse.jgit.api.CheckoutCommand import org.eclipse.jgit.api.CreateBranchCommand import org.eclipse.jgit.api.Git import org.eclipse.jgit.lib.ObjectIdRef -import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test class CheckoutRefUseCaseTest { @@ -18,7 +17,7 @@ class CheckoutRefUseCaseTest { @Test fun `invokes git checkout when ref is a local branch`() { val checkoutCommand = mockk(relaxed = true) - val branchName ="refs/heads/feature-branch" + val branchName = "refs/heads/feature-branch" every { refMock.name } returns branchName every { gitMock.checkout() } returns checkoutCommand diff --git a/src/test/kotlin/com/jetpackduba/gitnuro/git/diff/GenerateSplitHunkFromDiffResultUseCaseTest.kt b/src/test/kotlin/com/jetpackduba/gitnuro/git/diff/GenerateSplitHunkFromDiffResultUseCaseTest.kt index fff77903..edd87276 100644 --- a/src/test/kotlin/com/jetpackduba/gitnuro/git/diff/GenerateSplitHunkFromDiffResultUseCaseTest.kt +++ b/src/test/kotlin/com/jetpackduba/gitnuro/git/diff/GenerateSplitHunkFromDiffResultUseCaseTest.kt @@ -1,10 +1,9 @@ package com.jetpackduba.gitnuro.git.diff import io.mockk.mockk +import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Assertions.* - class GenerateSplitHunkFromDiffResultUseCaseTest { private val generateSplitHunkFromDiffResultUseCase = GenerateSplitHunkFromDiffResultUseCase()