Reformated proejct's code
6
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -12,6 +12,7 @@ A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
@ -24,5 +25,6 @@ A clear and concise description of what you expected to happen.
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. Linux]
|
||||
- Version [e.g. 1.0.1]
|
||||
|
||||
- OS: [e.g. Linux]
|
||||
- Version [e.g. 1.0.1]
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
## Installing libssh
|
||||
|
||||
Gitnuro depends on libssh being present as an external, native library (using [JNA](https://github.com/java-native-access/jna)).
|
||||
Gitnuro depends on libssh being present as an external, native library (
|
||||
using [JNA](https://github.com/java-native-access/jna)).
|
||||
While the release GitHub workflow packages it automatically, you'll need to install it manually when developing locally,
|
||||
such that it's available on the `$PATH`. See [here](https://www.libssh.org/get-it/) for one-liner installation
|
||||
instructions with your OS's package manager, or manually download a binary or compile it from source and place it in the
|
||||
@ -22,10 +23,12 @@ You don't need this if you only use the JDK installed by IntelliJ IDEA.
|
||||
|
||||
Check which Java version this project currently uses (`cat build.gradle.kts | grep JavaLanguageVersion`) and install it.
|
||||
For instance on Debian-based systems, you'd run:
|
||||
|
||||
```bash
|
||||
sudo apt-get install openjdk-17-jre openjdk-17-jdk libssh-dev
|
||||
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
|
||||
```
|
||||
|
||||
Once it works (e.g. `./gradlew build`), you may want to add that latter line to your `/etc/environment`.
|
||||
|
||||
## Running the app / unit tests
|
||||
|
@ -148,9 +148,10 @@ class App {
|
||||
.removeSuffix("$systemSeparator.git")
|
||||
val newKey = it.count()
|
||||
|
||||
val existingIndex = newList.indexOfFirst { repo -> repo.path?.removeSuffix(systemSeparator) == absolutePath }
|
||||
val existingIndex =
|
||||
newList.indexOfFirst { repo -> repo.path?.removeSuffix(systemSeparator) == absolutePath }
|
||||
|
||||
defaultSelectedTabKey = if(existingIndex == -1) {
|
||||
defaultSelectedTabKey = if (existingIndex == -1) {
|
||||
newList.add(newAppTab(key = newKey, path = absolutePath))
|
||||
newKey
|
||||
} else {
|
||||
|
@ -35,7 +35,7 @@ class AppFilesManager @Inject constructor() {
|
||||
|
||||
val appFolder = File(baseFolder, "gitnuro")
|
||||
// TODO test if mkdir fails for some reason
|
||||
if(!appFolder.exists() || !appFolder.isDirectory)
|
||||
if (!appFolder.exists() || !appFolder.isDirectory)
|
||||
appFolder.mkdir()
|
||||
|
||||
return appFolder
|
||||
|
@ -3,7 +3,6 @@ package com.jetpackduba.gitnuro
|
||||
import com.jetpackduba.gitnuro.di.TabScope
|
||||
import com.jetpackduba.gitnuro.extensions.openDirectory
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
import javax.inject.Inject
|
||||
|
||||
@TabScope
|
||||
@ -14,7 +13,7 @@ class TempFilesManager @Inject constructor(
|
||||
val appDataDir = appFilesManager.getAppFolder()
|
||||
val tempDir = appDataDir.openDirectory("tmp")
|
||||
|
||||
if(!tempDir.exists() || !tempDir.isDirectory) {
|
||||
if (!tempDir.exists() || !tempDir.isDirectory) {
|
||||
tempDir.mkdir()
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.jetpackduba.gitnuro.credentials
|
||||
|
||||
import com.jetpackduba.gitnuro.ssh.libssh.*
|
||||
import com.jetpackduba.gitnuro.ssh.libssh.LibSshChannel
|
||||
import com.jetpackduba.gitnuro.ssh.libssh.LibSshSession
|
||||
import java.io.InputStream
|
||||
import java.io.OutputStream
|
||||
|
||||
|
@ -3,7 +3,6 @@ package com.jetpackduba.gitnuro.credentials
|
||||
import com.jetpackduba.gitnuro.ssh.libssh.LibSshOptions
|
||||
import com.jetpackduba.gitnuro.ssh.libssh.LibSshSession
|
||||
import org.apache.sshd.client.SshClient
|
||||
import org.apache.sshd.client.future.ConnectFuture
|
||||
import org.eclipse.jgit.transport.RemoteSession
|
||||
import org.eclipse.jgit.transport.URIish
|
||||
import javax.inject.Inject
|
||||
@ -43,7 +42,7 @@ class GRemoteSession @Inject constructor(
|
||||
session.connect()
|
||||
var result = session.userAuthPublicKeyAuto(null, null)
|
||||
|
||||
if(result == 1) {
|
||||
if (result == 1) {
|
||||
credentialsStateManager.updateState(CredentialsRequested.SshCredentialsRequested)
|
||||
|
||||
var credentials = credentialsStateManager.currentCredentialsState
|
||||
@ -59,7 +58,7 @@ class GRemoteSession @Inject constructor(
|
||||
result = session.userAuthPublicKeyAuto(null, password)
|
||||
}
|
||||
|
||||
if(result != 0)
|
||||
if (result != 0)
|
||||
throw Exception("Something went wrong with authentication. Code $result")
|
||||
|
||||
this.session = session
|
||||
|
@ -151,7 +151,9 @@ class HttpCredentialsProvider @AssistedInject constructor(
|
||||
|
||||
bufferedReader.use {
|
||||
var line: String
|
||||
while (bufferedReader.readLine().also { line = checkNotNull(it) { "Cancelled authentication" } } != null && !(usernameSet && passwordSet)) {
|
||||
while (bufferedReader.readLine().also {
|
||||
line = checkNotNull(it) { "Cancelled authentication" }
|
||||
} != null && !(usernameSet && passwordSet)) {
|
||||
if (line.startsWith("username=")) {
|
||||
val split = line.split("=")
|
||||
val userName = split.getOrNull(1) ?: return ExternalCredentialsRequestResult.CREDENTIALS_NOT_STORED
|
||||
|
@ -4,8 +4,6 @@ import com.jetpackduba.gitnuro.App
|
||||
import com.jetpackduba.gitnuro.AppStateManager
|
||||
import com.jetpackduba.gitnuro.credentials.CredentialsStateManager
|
||||
import com.jetpackduba.gitnuro.di.modules.AppModule
|
||||
import com.jetpackduba.gitnuro.di.modules.NetworkModule
|
||||
import com.jetpackduba.gitnuro.di.modules.TabModule
|
||||
import com.jetpackduba.gitnuro.preferences.AppSettings
|
||||
import com.jetpackduba.gitnuro.viewmodels.SettingsViewModel
|
||||
import dagger.Component
|
||||
|
@ -28,7 +28,7 @@ fun runCommand(command: String): String? {
|
||||
fun runCommandWithoutResult(command: String, args: String, file: String): Boolean {
|
||||
val parts: Array<String> = prepareCommand(command, args, file)
|
||||
|
||||
printLog(TAG, "Running command ${parts.joinToString( )}")
|
||||
printLog(TAG, "Running command ${parts.joinToString()}")
|
||||
|
||||
return try {
|
||||
val p = Runtime.getRuntime().exec(parts) ?: return false
|
||||
|
@ -1,13 +1,9 @@
|
||||
package com.jetpackduba.gitnuro.git.workspace
|
||||
|
||||
import com.jetpackduba.gitnuro.credentials.GpgCredentialsProvider
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.eclipse.jgit.api.Git
|
||||
import org.eclipse.jgit.revwalk.RevCommit
|
||||
import org.eclipse.jgit.transport.CredentialItem
|
||||
import org.eclipse.jgit.transport.CredentialsProvider
|
||||
import org.eclipse.jgit.transport.URIish
|
||||
import javax.inject.Inject
|
||||
|
||||
class DoCommitUseCase @Inject constructor() {
|
||||
|
@ -24,7 +24,7 @@ class LibSshSession @Inject constructor() {
|
||||
fun userAuthPublicKeyAuto(username: String?, password: String?): Int {
|
||||
val result = sshLib.ssh_userauth_publickey_auto(session, username, password)
|
||||
|
||||
if(result != 0)
|
||||
if (result != 0)
|
||||
println("RESULT is $result. ERROR IS: ${getError()}")
|
||||
|
||||
return result
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.jetpackduba.gitnuro.ssh.libssh
|
||||
|
||||
import com.jetpackduba.gitnuro.extensions.getCurrentOs
|
||||
import com.sun.jna.Library
|
||||
import com.sun.jna.Native
|
||||
import com.sun.jna.PointerType
|
||||
@ -16,7 +15,7 @@ interface SSHLibrary : Library {
|
||||
|
||||
fun ssh_options_parse_config(session: ssh_session, fileName: String?): Int
|
||||
|
||||
fun ssh_connect(session: ssh_session) : Int
|
||||
fun ssh_connect(session: ssh_session): Int
|
||||
|
||||
fun ssh_userauth_agent(session: ssh_session, username: String?): Int
|
||||
fun ssh_userauth_publickey_auto(session: ssh_session, username: String?, password: String?): Int
|
||||
@ -29,7 +28,14 @@ interface SSHLibrary : Library {
|
||||
fun ssh_channel_request_exec(sshChannel: ssh_channel, command: String): Int
|
||||
|
||||
fun ssh_channel_read(sshChannel: ssh_channel, buffer: ByteArray, count: Int, isStderr: Int): Int
|
||||
fun ssh_channel_read_timeout(sshChannel: ssh_channel, buffer: ByteArray, count: Int, isStderr: Int, timeoutMs: Int): Int
|
||||
fun ssh_channel_read_timeout(
|
||||
sshChannel: ssh_channel,
|
||||
buffer: ByteArray,
|
||||
count: Int,
|
||||
isStderr: Int,
|
||||
timeoutMs: Int
|
||||
): Int
|
||||
|
||||
fun ssh_channel_poll(sshChannel: ssh_channel, isStderr: Int): Int
|
||||
fun ssh_channel_read_nonblocking(sshChannel: ssh_channel, buffer: ByteArray, count: Int, isStderr: Int): Int
|
||||
fun ssh_channel_write(sshChannel: ssh_channel, data: ByteArray, len: Int): Int
|
||||
|
@ -11,7 +11,7 @@ class LibSshChannelInputStream(private val sshChannel: ssh_channel) : InputStrea
|
||||
override fun read(b: ByteArray, off: Int, len: Int): Int {
|
||||
val byteArray = ByteArray(len)
|
||||
val result = sshLib.ssh_channel_read(sshChannel, byteArray, len, 0)
|
||||
for(i in 0 until len) {
|
||||
for (i in 0 until len) {
|
||||
b[off + i] = byteArray[i]
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,6 @@ fun AppTab(
|
||||
val repositorySelectionStatusValue = repositorySelectionStatus.value
|
||||
val isProcessing by tabViewModel.processing.collectAsState()
|
||||
|
||||
LocalTabScope.current.appStateManager
|
||||
Box {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
@ -95,7 +94,6 @@ fun AppTab(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isProcessing) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
|
@ -22,14 +22,13 @@ import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.jetpackduba.gitnuro.extensions.*
|
||||
import com.jetpackduba.gitnuro.keybindings.KeybindingOption
|
||||
import com.jetpackduba.gitnuro.keybindings.matchesBinding
|
||||
import com.jetpackduba.gitnuro.theme.notoSansMonoFontFamily
|
||||
import com.jetpackduba.gitnuro.theme.tertiarySurface
|
||||
import com.jetpackduba.gitnuro.theme.secondarySurface
|
||||
import com.jetpackduba.gitnuro.theme.tertiarySurface
|
||||
import com.jetpackduba.gitnuro.ui.components.PrimaryButton
|
||||
import com.jetpackduba.gitnuro.ui.components.ScrollableLazyColumn
|
||||
import org.eclipse.jgit.blame.BlameResult
|
||||
|
@ -27,8 +27,8 @@ import com.jetpackduba.gitnuro.extensions.toSmartSystemString
|
||||
import com.jetpackduba.gitnuro.git.diff.DiffResult
|
||||
import com.jetpackduba.gitnuro.keybindings.KeybindingOption
|
||||
import com.jetpackduba.gitnuro.keybindings.matchesBinding
|
||||
import com.jetpackduba.gitnuro.theme.tertiarySurface
|
||||
import com.jetpackduba.gitnuro.theme.onBackgroundSecondary
|
||||
import com.jetpackduba.gitnuro.theme.tertiarySurface
|
||||
import com.jetpackduba.gitnuro.ui.components.AvatarImage
|
||||
import com.jetpackduba.gitnuro.ui.components.ScrollableLazyColumn
|
||||
import com.jetpackduba.gitnuro.ui.components.TooltipText
|
||||
|
@ -11,7 +11,6 @@ import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.jetpackduba.gitnuro.theme.textButtonColors
|
||||
import com.jetpackduba.gitnuro.ui.components.AdjustableOutlinedTextField
|
||||
import com.jetpackduba.gitnuro.ui.components.PrimaryButton
|
||||
import com.jetpackduba.gitnuro.ui.components.ScrollableLazyColumn
|
||||
@ -148,7 +147,7 @@ fun RebaseCommit(
|
||||
onMessageChanged(it)
|
||||
},
|
||||
textStyle = MaterialTheme.typography.body2,
|
||||
backgroundColor = if(rebaseLine.action == Action.REWORD) {
|
||||
backgroundColor = if (rebaseLine.action == Action.REWORD) {
|
||||
MaterialTheme.colors.background
|
||||
} else
|
||||
MaterialTheme.colors.surface
|
||||
|
@ -53,7 +53,8 @@ fun SidePanel(
|
||||
.padding(start = 8.dp)
|
||||
)
|
||||
|
||||
ScrollableLazyColumn(modifier = Modifier
|
||||
ScrollableLazyColumn(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(top = 4.dp)
|
||||
) {
|
||||
|
@ -89,7 +89,7 @@ private fun openJvmDialog(
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
|
||||
}
|
||||
|
||||
if(isMac) {
|
||||
if (isMac) {
|
||||
System.setProperty("apple.awt.fileDialogForDirectories", "true")
|
||||
val fileChooser = if (basePath.isNullOrEmpty())
|
||||
FileDialog(null as java.awt.Frame?, "Open", FileDialog.LOAD)
|
||||
|
@ -40,7 +40,10 @@ import com.jetpackduba.gitnuro.theme.*
|
||||
import com.jetpackduba.gitnuro.ui.components.ScrollableLazyColumn
|
||||
import com.jetpackduba.gitnuro.ui.components.SecondaryButton
|
||||
import com.jetpackduba.gitnuro.ui.components.gitnuroViewModel
|
||||
import com.jetpackduba.gitnuro.ui.context_menu.*
|
||||
import com.jetpackduba.gitnuro.ui.context_menu.ContextMenu
|
||||
import com.jetpackduba.gitnuro.ui.context_menu.ContextMenuElement
|
||||
import com.jetpackduba.gitnuro.ui.context_menu.EntryType
|
||||
import com.jetpackduba.gitnuro.ui.context_menu.statusEntriesContextMenuItems
|
||||
import com.jetpackduba.gitnuro.viewmodels.StageStatus
|
||||
import com.jetpackduba.gitnuro.viewmodels.StatusViewModel
|
||||
import org.eclipse.jgit.lib.RepositoryState
|
||||
|
@ -26,7 +26,6 @@ import com.jetpackduba.gitnuro.extensions.*
|
||||
import com.jetpackduba.gitnuro.theme.onBackgroundSecondary
|
||||
import com.jetpackduba.gitnuro.theme.textButtonColors
|
||||
import com.jetpackduba.gitnuro.ui.dialogs.AppInfoDialog
|
||||
import com.jetpackduba.gitnuro.ui.dialogs.CloneDialog
|
||||
import com.jetpackduba.gitnuro.updates.Update
|
||||
import com.jetpackduba.gitnuro.viewmodels.TabViewModel
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.jetpackduba.gitnuro.ui.components
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
@ -14,7 +13,6 @@ import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.jetpackduba.gitnuro.extensions.backgroundIf
|
||||
import com.jetpackduba.gitnuro.extensions.handMouseClickable
|
||||
import com.jetpackduba.gitnuro.extensions.handOnHover
|
||||
|
||||
|
||||
@Composable
|
||||
@ -33,7 +31,7 @@ fun PrimaryButton(
|
||||
.clip(RoundedCornerShape(4.dp))
|
||||
.backgroundIf(enabled, backgroundColor, backgroundDisabled)
|
||||
.run {
|
||||
if(enabled) {
|
||||
if (enabled) {
|
||||
handMouseClickable {
|
||||
onClick()
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.jetpackduba.gitnuro.ui.context_menu
|
||||
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
|
||||
fun pullContextMenuItems(
|
||||
onPullRebase: () -> Unit,
|
||||
onFetchAll: () -> Unit,
|
||||
|
@ -1,29 +1,7 @@
|
||||
package com.jetpackduba.gitnuro.ui.dialogs
|
||||
|
||||
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.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusProperties
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.runtime.Composable
|
||||
import com.jetpackduba.gitnuro.credentials.CredentialsRequested
|
||||
import com.jetpackduba.gitnuro.credentials.CredentialsState
|
||||
import com.jetpackduba.gitnuro.keybindings.KeybindingOption
|
||||
import com.jetpackduba.gitnuro.keybindings.matchesBinding
|
||||
import com.jetpackduba.gitnuro.theme.outlinedTextFieldColors
|
||||
import com.jetpackduba.gitnuro.theme.onBackgroundSecondary
|
||||
import com.jetpackduba.gitnuro.ui.components.AdjustableOutlinedTextField
|
||||
import com.jetpackduba.gitnuro.ui.components.PrimaryButton
|
||||
|
||||
@Composable
|
||||
fun GpgPasswordDialog(
|
||||
|
@ -19,7 +19,6 @@ import androidx.compose.ui.unit.dp
|
||||
import com.jetpackduba.gitnuro.extensions.backgroundIf
|
||||
import com.jetpackduba.gitnuro.extensions.handMouseClickable
|
||||
import com.jetpackduba.gitnuro.keybindings.KeybindingOption
|
||||
import com.jetpackduba.gitnuro.keybindings.keybindings
|
||||
import com.jetpackduba.gitnuro.keybindings.matchesBinding
|
||||
import com.jetpackduba.gitnuro.theme.backgroundSelected
|
||||
import com.jetpackduba.gitnuro.ui.components.AdjustableOutlinedTextField
|
||||
|
@ -1,10 +1,8 @@
|
||||
package com.jetpackduba.gitnuro.ui.dialogs
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.OutlinedTextField
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
@ -21,7 +19,6 @@ import androidx.compose.ui.unit.dp
|
||||
import com.jetpackduba.gitnuro.keybindings.KeybindingOption
|
||||
import com.jetpackduba.gitnuro.keybindings.matchesBinding
|
||||
import com.jetpackduba.gitnuro.theme.onBackgroundSecondary
|
||||
import com.jetpackduba.gitnuro.theme.outlinedTextFieldColors
|
||||
import com.jetpackduba.gitnuro.ui.components.AdjustableOutlinedTextField
|
||||
import com.jetpackduba.gitnuro.ui.components.PrimaryButton
|
||||
|
||||
|
@ -8,7 +8,6 @@ import com.jetpackduba.gitnuro.git.rebase.AbortRebaseUseCase
|
||||
import com.jetpackduba.gitnuro.git.rebase.GetRebaseLinesFullMessageUseCase
|
||||
import com.jetpackduba.gitnuro.git.rebase.ResumeRebaseInteractiveUseCase
|
||||
import com.jetpackduba.gitnuro.git.rebase.StartRebaseInteractiveUseCase
|
||||
import com.jetpackduba.gitnuro.logging.printLog
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
@ -194,6 +194,7 @@ class StatusViewModel @Inject constructor(
|
||||
private suspend fun loadHasUncommitedChanges(git: Git) = withContext(Dispatchers.IO) {
|
||||
lastUncommitedChangesState = checkHasUncommitedChangedUseCase(git)
|
||||
}
|
||||
|
||||
fun amend(isAmend: Boolean) {
|
||||
_isAmend.value = isAmend
|
||||
|
||||
|
@ -3,7 +3,6 @@ package com.jetpackduba.gitnuro.viewmodels
|
||||
import com.jetpackduba.gitnuro.AppStateManager
|
||||
import com.jetpackduba.gitnuro.ErrorsManager
|
||||
import com.jetpackduba.gitnuro.credentials.CredentialsAccepted
|
||||
import com.jetpackduba.gitnuro.credentials.CredentialsRequested
|
||||
import com.jetpackduba.gitnuro.credentials.CredentialsState
|
||||
import com.jetpackduba.gitnuro.credentials.CredentialsStateManager
|
||||
import com.jetpackduba.gitnuro.git.*
|
||||
@ -21,7 +20,8 @@ import com.jetpackduba.gitnuro.ui.SelectedItem
|
||||
import com.jetpackduba.gitnuro.updates.Update
|
||||
import com.jetpackduba.gitnuro.updates.UpdatesRepository
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.flow.*
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import org.eclipse.jgit.api.Git
|
||||
import org.eclipse.jgit.api.errors.CheckoutConflictException
|
||||
import org.eclipse.jgit.blame.BlameResult
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.jetpackduba.gitnuro.viewmodels
|
||||
|
||||
import com.jetpackduba.gitnuro.di.TabScope
|
||||
import com.jetpackduba.gitnuro.viewmodels.sidepanel.*
|
||||
import com.jetpackduba.gitnuro.viewmodels.sidepanel.SidePanelViewModel
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Provider
|
||||
|
||||
|
@ -16,7 +16,6 @@ import kotlinx.coroutines.flow.*
|
||||
import kotlinx.coroutines.launch
|
||||
import org.eclipse.jgit.api.Git
|
||||
import org.eclipse.jgit.lib.Ref
|
||||
import javax.inject.Inject
|
||||
|
||||
private const val TAG = "BranchesViewModel"
|
||||
|
||||
@ -40,7 +39,8 @@ class BranchesViewModel @AssistedInject constructor(
|
||||
private val _branches = MutableStateFlow<List<Ref>>(listOf())
|
||||
private val _currentBranch = MutableStateFlow<Ref?>(null)
|
||||
|
||||
val branchesState = combine(_branches, _currentBranch, isExpanded, filter) { branches, currentBranch, isExpanded, filter ->
|
||||
val branchesState =
|
||||
combine(_branches, _currentBranch, isExpanded, filter) { branches, currentBranch, isExpanded, filter ->
|
||||
BranchesState(
|
||||
branches = branches.filter { it.simpleName.lowercaseContains(filter) },
|
||||
isExpanded = isExpanded,
|
||||
|
@ -103,7 +103,7 @@ class RemotesViewModel @AssistedInject constructor(
|
||||
val remotes = this.remotes.value
|
||||
val remoteInfo = remotes.firstOrNull { it.remoteInfo.remoteConfig.name == remoteName }
|
||||
|
||||
if(remoteInfo != null) {
|
||||
if (remoteInfo != null) {
|
||||
val newRemoteInfo = remoteInfo.copy(isExpanded = !remoteClicked.isExpanded)
|
||||
val newRemotesList = remotes.toMutableList()
|
||||
val indexToReplace = newRemotesList.indexOf(remoteInfo)
|
||||
|
@ -1 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000">
|
||||
<path d="M0 0h24v24H0V0z" fill="none"/>
|
||||
<path d="M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 326 B After Width: | Height: | Size: 337 B |
@ -1,10 +1,10 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_140_416)">
|
||||
<path d="M19 9H15V3H9V9H5L12 16L19 9ZM11 11V5H13V11H14.17L12 13.17L9.83 11H11Z" fill="white"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_140_416">
|
||||
<rect width="24" height="24" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
<g clip-path="url(#clip0_140_416)">
|
||||
<path d="M19 9H15V3H9V9H5L12 16L19 9ZM11 11V5H13V11H14.17L12 13.17L9.83 11H11Z" fill="white"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_140_416">
|
||||
<rect width="24" height="24" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 340 B After Width: | Height: | Size: 392 B |
@ -1 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><rect fill="none" height="24" width="24"/></g><g><path d="M21,10h-8.35C11.83,7.67,9.61,6,7,6c-3.31,0-6,2.69-6,6s2.69,6,6,6c2.61,0,4.83-1.67,5.65-4H13l2,2l2-2l2,2l4-4.04L21,10z M7,15c-1.65,0-3-1.35-3-3c0-1.65,1.35-3,3-3s3,1.35,3,3C10,13.65,8.65,15,7,15z"/></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px"
|
||||
fill="#000000">
|
||||
<g>
|
||||
<rect fill="none" height="24" width="24"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M21,10h-8.35C11.83,7.67,9.61,6,7,6c-3.31,0-6,2.69-6,6s2.69,6,6,6c2.61,0,4.83-1.67,5.65-4H13l2,2l2-2l2,2l4-4.04L21,10z M7,15c-1.65,0-3-1.35-3-3c0-1.65,1.35-3,3-3s3,1.35,3,3C10,13.65,8.65,15,7,15z"/>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 404 B After Width: | Height: | Size: 448 B |
@ -1 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><rect fill="none" height="24" width="24"/></g><g><path d="M6.41,21L5,19.59l4.83-4.83c0.75-0.75,1.17-1.77,1.17-2.83v-5.1L9.41,8.41L8,7l4-4l4,4l-1.41,1.41L13,6.83v5.1 c0,1.06,0.42,2.08,1.17,2.83L19,19.59L17.59,21L12,15.41L6.41,21z"/></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px"
|
||||
fill="#000000">
|
||||
<g>
|
||||
<rect fill="none" height="24" width="24"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M6.41,21L5,19.59l4.83-4.83c0.75-0.75,1.17-1.77,1.17-2.83v-5.1L9.41,8.41L8,7l4-4l4,4l-1.41,1.41L13,6.83v5.1 c0,1.06,0.42,2.08,1.17,2.83L19,19.59L17.59,21L12,15.41L6.41,21z"/>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 380 B After Width: | Height: | Size: 424 B |
@ -1 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000">
|
||||
<path d="M0 0h24v24H0z" fill="none"/>
|
||||
<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 391 B After Width: | Height: | Size: 402 B |
@ -1 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><rect fill="none" height="24" width="24"/></g><g><path d="M20,4H4C2.89,4,2,4.9,2,6v12c0,1.1,0.89,2,2,2h16c1.1,0,2-0.9,2-2V6C22,4.9,21.11,4,20,4z M20,18H4V8h16V18z M18,17h-6v-2 h6V17z M7.5,17l-1.41-1.41L8.67,13l-2.59-2.59L7.5,9l4,4L7.5,17z"/></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px"
|
||||
fill="#000000">
|
||||
<g>
|
||||
<rect fill="none" height="24" width="24"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M20,4H4C2.89,4,2,4.9,2,6v12c0,1.1,0.89,2,2,2h16c1.1,0,2-0.9,2-2V6C22,4.9,21.11,4,20,4z M20,18H4V8h16V18z M18,17h-6v-2 h6V17z M7.5,17l-1.41-1.41L8.67,13l-2.59-2.59L7.5,9l4,4L7.5,17z"/>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 390 B After Width: | Height: | Size: 434 B |
@ -1 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000">
|
||||
<path d="M0 0h24v24H0z" fill="none"/>
|
||||
<path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 377 B |
@ -1 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z" fill="none"/><path d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000">
|
||||
<path d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z" fill="none"/>
|
||||
<path d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 701 B After Width: | Height: | Size: 712 B |
@ -1,6 +1,9 @@
|
||||
package com.jetpackduba.gitnuro.app.git
|
||||
|
||||
import com.jetpackduba.gitnuro.credentials.*
|
||||
import com.jetpackduba.gitnuro.credentials.CredentialsStateManager
|
||||
import com.jetpackduba.gitnuro.credentials.GRemoteSession
|
||||
import com.jetpackduba.gitnuro.credentials.GSessionManager
|
||||
import com.jetpackduba.gitnuro.credentials.HttpCredentialsProvider
|
||||
import com.jetpackduba.gitnuro.di.factories.HttpCredentialsFactory
|
||||
import com.jetpackduba.gitnuro.git.remote_operations.CloneRepositoryUseCase
|
||||
import com.jetpackduba.gitnuro.git.remote_operations.HandleTransportUseCase
|
||||
|