diff --git a/src/main/kotlin/app/ui/context_menu/LogContextMenu.kt b/src/main/kotlin/app/ui/context_menu/LogContextMenu.kt index 3927869..7534144 100644 --- a/src/main/kotlin/app/ui/context_menu/LogContextMenu.kt +++ b/src/main/kotlin/app/ui/context_menu/LogContextMenu.kt @@ -32,9 +32,8 @@ fun logContextMenu( label = "Cherry-pick commit", onClick = onCherryPickCommit ), - ContextMenuItem( label = "Reset current branch to this commit", onClick = onResetBranch - ) + ), ) \ No newline at end of file diff --git a/src/main/kotlin/app/ui/log/Log.kt b/src/main/kotlin/app/ui/log/Log.kt index c3e99db..65743bb 100644 --- a/src/main/kotlin/app/ui/log/Log.kt +++ b/src/main/kotlin/app/ui/log/Log.kt @@ -54,6 +54,7 @@ import app.viewmodels.LogStatus import app.viewmodels.LogViewModel import kotlinx.coroutines.flow.collect import kotlinx.coroutines.launch +import openDirectoryDialog import org.eclipse.jgit.lib.Ref import org.eclipse.jgit.lib.RepositoryState import org.eclipse.jgit.revwalk.RevCommit @@ -339,9 +340,8 @@ fun MessagesList( resetBranch = { onShowLogDialog(LogDialog.ResetBranch(graphNode)) }, onMergeBranch = { ref -> onShowLogDialog(LogDialog.MergeBranch(ref)) }, onRebaseBranch = { ref -> onShowLogDialog(LogDialog.RebaseBranch(ref)) }, - onRevCommitSelected = { - logViewModel.selectLogLine(graphNode) - }) + onRevCommitSelected = { logViewModel.selectLogLine(graphNode) }, + ) } } } @@ -609,10 +609,10 @@ fun CommitLine( matchesSearchFilter: Boolean?, showCreateNewBranch: () -> Unit, showCreateNewTag: () -> Unit, - resetBranch: (GraphNode) -> Unit, + resetBranch: () -> Unit, onMergeBranch: (Ref) -> Unit, onRebaseBranch: (Ref) -> Unit, - onRevCommitSelected: (GraphNode) -> Unit, + onRevCommitSelected: () -> Unit, ) { ContextMenuArea( items = { @@ -622,13 +622,13 @@ fun CommitLine( onCreateNewTag = showCreateNewTag, onRevertCommit = { logViewModel.revertCommit(graphNode) }, onCherryPickCommit = { logViewModel.cherrypickCommit(graphNode) }, - onResetBranch = { resetBranch(graphNode) }, + onResetBranch = { resetBranch() }, ) }, ) { Box( modifier = Modifier.clickable { - onRevCommitSelected(graphNode) + onRevCommitSelected() }.padding(start = graphWidth) .height(40.dp) ) { diff --git a/src/main/kotlin/app/viewmodels/LogViewModel.kt b/src/main/kotlin/app/viewmodels/LogViewModel.kt index e4a7f1c..98e4f06 100644 --- a/src/main/kotlin/app/viewmodels/LogViewModel.kt +++ b/src/main/kotlin/app/viewmodels/LogViewModel.kt @@ -263,14 +263,14 @@ class LogViewModel @Inject constructor( suspend fun selectPreviousFilterCommit() { val logSearchFilterResultsValue = logSearchFilterResults.value - if(logSearchFilterResultsValue !is LogSearch.SearchResults) { + if (logSearchFilterResultsValue !is LogSearch.SearchResults) { return } val index = logSearchFilterResultsValue.index val commits = logSearchFilterResultsValue.commits - if(index == NONE_MATCHING_INDEX || index == FIRST_INDEX) + if (index == NONE_MATCHING_INDEX || index == FIRST_INDEX) return val newIndex = index - 1 @@ -283,7 +283,7 @@ class LogViewModel @Inject constructor( suspend fun selectNextFilterCommit() { val logSearchFilterResultsValue = logSearchFilterResults.value - if(logSearchFilterResultsValue !is LogSearch.SearchResults) { + if (logSearchFilterResultsValue !is LogSearch.SearchResults) { return } @@ -291,7 +291,7 @@ class LogViewModel @Inject constructor( val commits = logSearchFilterResultsValue.commits val totalCount = logSearchFilterResultsValue.totalCount - if(index == NONE_MATCHING_INDEX || index == totalCount) + if (index == NONE_MATCHING_INDEX || index == totalCount) return val newIndex = index + 1