Support setting the similarity threshold for detecting renames

This commit is contained in:
István Donkó 2023-09-25 17:32:12 +02:00 committed by Jesse Duffield
parent bfe2dd4ed8
commit b9107d5fc8
26 changed files with 909 additions and 618 deletions

View file

@ -521,6 +521,8 @@ keybinding:
toggleWhitespaceInDiffView: <c-w> toggleWhitespaceInDiffView: <c-w>
increaseContextInDiffView: '}' increaseContextInDiffView: '}'
decreaseContextInDiffView: '{' decreaseContextInDiffView: '{'
increaseRenameSimilarityThreshold: )
decreaseRenameSimilarityThreshold: (
openDiffTool: <c-t> openDiffTool: <c-t>
status: status:
checkForUpdate: u checkForUpdate: u

View file

@ -14,6 +14,8 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
| `` @ `` | View command log options | View options for the command log e.g. show/hide the command log and focus the command log. | | `` @ `` | View command log options | View options for the command log e.g. show/hide the command log and focus the command log. |
| `` P `` | Push | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. | | `` P `` | Push | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
| `` p `` | Pull | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. | | `` p `` | Pull | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
| `` ) `` | Increase rename similarity threshold | Increase the similarity threshold for a deletion and addition pair to be treated as a rename. |
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
| `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view. | | `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view. |
| `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view. | | `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view. |
| `` : `` | Execute custom command | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. | | `` : `` | Execute custom command | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. |

View file

@ -14,6 +14,8 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
| `` @ `` | コマンドログメニューを開く | View options for the command log e.g. show/hide the command log and focus the command log. | | `` @ `` | コマンドログメニューを開く | View options for the command log e.g. show/hide the command log and focus the command log. |
| `` P `` | Push | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. | | `` P `` | Push | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
| `` p `` | Pull | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. | | `` p `` | Pull | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
| `` ) `` | Increase rename similarity threshold | Increase the similarity threshold for a deletion and addition pair to be treated as a rename. |
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
| `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view. | | `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view. |
| `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view. | | `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view. |
| `` : `` | カスタムコマンドを実行 | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. | | `` : `` | カスタムコマンドを実行 | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. |

View file

@ -14,6 +14,8 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
| `` @ `` | 명령어 로그 메뉴 열기 | View options for the command log e.g. show/hide the command log and focus the command log. | | `` @ `` | 명령어 로그 메뉴 열기 | View options for the command log e.g. show/hide the command log and focus the command log. |
| `` P `` | 푸시 | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. | | `` P `` | 푸시 | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
| `` p `` | 업데이트 | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. | | `` p `` | 업데이트 | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
| `` ) `` | Increase rename similarity threshold | Increase the similarity threshold for a deletion and addition pair to be treated as a rename. |
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
| `` } `` | Diff 보기의 변경 사항 주위에 표시되는 컨텍스트의 크기를 늘리기 | Increase the amount of the context shown around changes in the diff view. | | `` } `` | Diff 보기의 변경 사항 주위에 표시되는 컨텍스트의 크기를 늘리기 | Increase the amount of the context shown around changes in the diff view. |
| `` { `` | Diff 보기의 변경 사항 주위에 표시되는 컨텍스트 크기 줄이기 | Decrease the amount of the context shown around changes in the diff view. | | `` { `` | Diff 보기의 변경 사항 주위에 표시되는 컨텍스트 크기 줄이기 | Decrease the amount of the context shown around changes in the diff view. |
| `` : `` | Execute custom command | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. | | `` : `` | Execute custom command | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. |

View file

@ -14,6 +14,8 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
| `` @ `` | View command log options | View options for the command log e.g. show/hide the command log and focus the command log. | | `` @ `` | View command log options | View options for the command log e.g. show/hide the command log and focus the command log. |
| `` P `` | Push | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. | | `` P `` | Push | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
| `` p `` | Pull | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. | | `` p `` | Pull | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
| `` ) `` | Increase rename similarity threshold | Increase the similarity threshold for a deletion and addition pair to be treated as a rename. |
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
| `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view. | | `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view. |
| `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view. | | `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view. |
| `` : `` | Voer aangepaste commando uit | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. | | `` : `` | Voer aangepaste commando uit | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. |

View file

@ -14,6 +14,8 @@ _Legenda: `<c-b>` oznacza ctrl+b, `<a-b>` oznacza alt+b, `B` oznacza shift+b_
| `` @ `` | Pokaż opcje dziennika poleceń | Pokaż opcje dla dziennika poleceń, np. pokazywanie/ukrywanie dziennika poleceń i skupienie na dzienniku poleceń. | | `` @ `` | Pokaż opcje dziennika poleceń | Pokaż opcje dla dziennika poleceń, np. pokazywanie/ukrywanie dziennika poleceń i skupienie na dzienniku poleceń. |
| `` P `` | Wypchnij | Wypchnij bieżącą gałąź do jej gałęzi nadrzędnej. Jeśli nie skonfigurowano gałęzi nadrzędnej, zostaniesz poproszony o skonfigurowanie gałęzi nadrzędnej. | | `` P `` | Wypchnij | Wypchnij bieżącą gałąź do jej gałęzi nadrzędnej. Jeśli nie skonfigurowano gałęzi nadrzędnej, zostaniesz poproszony o skonfigurowanie gałęzi nadrzędnej. |
| `` p `` | Pociągnij | Pociągnij zmiany z zdalnego dla bieżącej gałęzi. Jeśli nie skonfigurowano gałęzi nadrzędnej, zostaniesz poproszony o skonfigurowanie gałęzi nadrzędnej. | | `` p `` | Pociągnij | Pociągnij zmiany z zdalnego dla bieżącej gałęzi. Jeśli nie skonfigurowano gałęzi nadrzędnej, zostaniesz poproszony o skonfigurowanie gałęzi nadrzędnej. |
| `` ) `` | Increase rename similarity threshold | Increase the similarity threshold for a deletion and addition pair to be treated as a rename. |
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
| `` } `` | Zwiększ rozmiar kontekstu w widoku różnic | Zwiększ ilość kontekstu pokazywanego wokół zmian w widoku różnic. | | `` } `` | Zwiększ rozmiar kontekstu w widoku różnic | Zwiększ ilość kontekstu pokazywanego wokół zmian w widoku różnic. |
| `` { `` | Zmniejsz rozmiar kontekstu w widoku różnic | Zmniejsz ilość kontekstu pokazywanego wokół zmian w widoku różnic. | | `` { `` | Zmniejsz rozmiar kontekstu w widoku różnic | Zmniejsz ilość kontekstu pokazywanego wokół zmian w widoku różnic. |
| `` : `` | Wykonaj polecenie niestandardowe | Wyświetl monit, w którym możesz wprowadzić polecenie powłoki do wykonania. Nie należy mylić z wcześniej skonfigurowanymi poleceniami niestandardowymi. | | `` : `` | Wykonaj polecenie niestandardowe | Wyświetl monit, w którym możesz wprowadzić polecenie powłoki do wykonania. Nie należy mylić z wcześniej skonfigurowanymi poleceniami niestandardowymi. |

View file

@ -14,6 +14,8 @@ _Связки клавиш_
| `` @ `` | Открыть меню журнала команд | View options for the command log e.g. show/hide the command log and focus the command log. | | `` @ `` | Открыть меню журнала команд | View options for the command log e.g. show/hide the command log and focus the command log. |
| `` P `` | Отправить изменения | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. | | `` P `` | Отправить изменения | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
| `` p `` | Получить и слить изменения | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. | | `` p `` | Получить и слить изменения | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
| `` ) `` | Increase rename similarity threshold | Increase the similarity threshold for a deletion and addition pair to be treated as a rename. |
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
| `` } `` | Увеличить размер контекста, отображаемого вокруг изменений в просмотрщике сравнении | Increase the amount of the context shown around changes in the diff view. | | `` } `` | Увеличить размер контекста, отображаемого вокруг изменений в просмотрщике сравнении | Increase the amount of the context shown around changes in the diff view. |
| `` { `` | Уменьшите размер контекста, отображаемого вокруг изменений в просмотрщике сравнении | Decrease the amount of the context shown around changes in the diff view. | | `` { `` | Уменьшите размер контекста, отображаемого вокруг изменений в просмотрщике сравнении | Decrease the amount of the context shown around changes in the diff view. |
| `` : `` | Выполнить пользовательскую команду | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. | | `` : `` | Выполнить пользовательскую команду | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. |

View file

@ -14,6 +14,8 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
| `` @ `` | 打开命令日志菜单 | View options for the command log e.g. show/hide the command log and focus the command log. | | `` @ `` | 打开命令日志菜单 | View options for the command log e.g. show/hide the command log and focus the command log. |
| `` P `` | 推送 | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. | | `` P `` | 推送 | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
| `` p `` | 拉取 | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. | | `` p `` | 拉取 | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
| `` ) `` | Increase rename similarity threshold | Increase the similarity threshold for a deletion and addition pair to be treated as a rename. |
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
| `` } `` | 扩大差异视图中显示的上下文范围 | Increase the amount of the context shown around changes in the diff view. | | `` } `` | 扩大差异视图中显示的上下文范围 | Increase the amount of the context shown around changes in the diff view. |
| `` { `` | 缩小差异视图中显示的上下文范围 | Decrease the amount of the context shown around changes in the diff view. | | `` { `` | 缩小差异视图中显示的上下文范围 | Decrease the amount of the context shown around changes in the diff view. |
| `` : `` | 执行自定义命令 | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. | | `` : `` | 执行自定义命令 | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. |

View file

@ -14,6 +14,8 @@ _說明`<c-b>` 表示 CtrlB、`<a-b>` 表示 AltB`B`表示 ShiftB
| `` @ `` | 開啟命令記錄選單 | View options for the command log e.g. show/hide the command log and focus the command log. | | `` @ `` | 開啟命令記錄選單 | View options for the command log e.g. show/hide the command log and focus the command log. |
| `` P `` | 推送 | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. | | `` P `` | 推送 | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
| `` p `` | 拉取 | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. | | `` p `` | 拉取 | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
| `` ) `` | Increase rename similarity threshold | Increase the similarity threshold for a deletion and addition pair to be treated as a rename. |
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
| `` } `` | 增加差異檢視中顯示變更周圍上下文的大小 | Increase the amount of the context shown around changes in the diff view. | | `` } `` | 增加差異檢視中顯示變更周圍上下文的大小 | Increase the amount of the context shown around changes in the diff view. |
| `` { `` | 減小差異檢視中顯示變更周圍上下文的大小 | Decrease the amount of the context shown around changes in the diff view. | | `` { `` | 減小差異檢視中顯示變更周圍上下文的大小 | Decrease the amount of the context shown around changes in the diff view. |
| `` : `` | 執行自訂命令 | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. | | `` : `` | 執行自訂命令 | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. |

View file

@ -271,6 +271,7 @@ func (self *CommitCommands) ShowCmdObj(hash string, filterPath string) oscommand
Arg("-p"). Arg("-p").
Arg(hash). Arg(hash).
ArgIf(self.AppState.IgnoreWhitespaceInDiffView, "--ignore-all-space"). ArgIf(self.AppState.IgnoreWhitespaceInDiffView, "--ignore-all-space").
Arg(fmt.Sprintf("--find-renames=%d%%", self.AppState.RenameSimilarityThreshold)).
ArgIf(filterPath != "", "--", filterPath). ArgIf(filterPath != "", "--", filterPath).
Dir(self.repoPaths.worktreePath). Dir(self.repoPaths.worktreePath).
ToArgv() ToArgv()

View file

@ -228,54 +228,69 @@ func TestCommitCreateAmendCommit(t *testing.T) {
func TestCommitShowCmdObj(t *testing.T) { func TestCommitShowCmdObj(t *testing.T) {
type scenario struct { type scenario struct {
testName string testName string
filterPath string filterPath string
contextSize int contextSize int
ignoreWhitespace bool similarityThreshold int
extDiffCmd string ignoreWhitespace bool
expected []string extDiffCmd string
expected []string
} }
scenarios := []scenario{ scenarios := []scenario{
{ {
testName: "Default case without filter path", testName: "Default case without filter path",
filterPath: "", filterPath: "",
contextSize: 3, contextSize: 3,
ignoreWhitespace: false, similarityThreshold: 50,
extDiffCmd: "", ignoreWhitespace: false,
expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=3", "--stat", "--decorate", "-p", "1234567890"}, extDiffCmd: "",
expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=3", "--stat", "--decorate", "-p", "1234567890", "--find-renames=50%"},
}, },
{ {
testName: "Default case with filter path", testName: "Default case with filter path",
filterPath: "file.txt", filterPath: "file.txt",
contextSize: 3, contextSize: 3,
ignoreWhitespace: false, similarityThreshold: 50,
extDiffCmd: "", ignoreWhitespace: false,
expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=3", "--stat", "--decorate", "-p", "1234567890", "--", "file.txt"}, extDiffCmd: "",
expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=3", "--stat", "--decorate", "-p", "1234567890", "--find-renames=50%", "--", "file.txt"},
}, },
{ {
testName: "Show diff with custom context size", testName: "Show diff with custom context size",
filterPath: "", filterPath: "",
contextSize: 77, contextSize: 77,
ignoreWhitespace: false, similarityThreshold: 50,
extDiffCmd: "", ignoreWhitespace: false,
expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=77", "--stat", "--decorate", "-p", "1234567890"}, extDiffCmd: "",
expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=77", "--stat", "--decorate", "-p", "1234567890", "--find-renames=50%"},
}, },
{ {
testName: "Show diff, ignoring whitespace", testName: "Show diff with custom similarity threshold",
filterPath: "", filterPath: "",
contextSize: 77, contextSize: 3,
ignoreWhitespace: true, similarityThreshold: 33,
extDiffCmd: "", ignoreWhitespace: false,
expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=77", "--stat", "--decorate", "-p", "1234567890", "--ignore-all-space"}, extDiffCmd: "",
expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=3", "--stat", "--decorate", "-p", "1234567890", "--find-renames=33%"},
}, },
{ {
testName: "Show diff with external diff command", testName: "Show diff, ignoring whitespace",
filterPath: "", filterPath: "",
contextSize: 3, contextSize: 77,
ignoreWhitespace: false, similarityThreshold: 50,
extDiffCmd: "difft --color=always", ignoreWhitespace: true,
expected: []string{"-C", "/path/to/worktree", "-c", "diff.external=difft --color=always", "-c", "diff.noprefix=false", "show", "--ext-diff", "--submodule", "--color=always", "--unified=3", "--stat", "--decorate", "-p", "1234567890"}, extDiffCmd: "",
expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=77", "--stat", "--decorate", "-p", "1234567890", "--ignore-all-space", "--find-renames=50%"},
},
{
testName: "Show diff with external diff command",
filterPath: "",
contextSize: 3,
similarityThreshold: 50,
ignoreWhitespace: false,
extDiffCmd: "difft --color=always",
expected: []string{"-C", "/path/to/worktree", "-c", "diff.external=difft --color=always", "-c", "diff.noprefix=false", "show", "--ext-diff", "--submodule", "--color=always", "--unified=3", "--stat", "--decorate", "-p", "1234567890", "--find-renames=50%"},
}, },
} }
@ -286,6 +301,7 @@ func TestCommitShowCmdObj(t *testing.T) {
appState := &config.AppState{} appState := &config.AppState{}
appState.IgnoreWhitespaceInDiffView = s.ignoreWhitespace appState.IgnoreWhitespaceInDiffView = s.ignoreWhitespace
appState.DiffContextSize = s.contextSize appState.DiffContextSize = s.contextSize
appState.RenameSimilarityThreshold = s.similarityThreshold
runner := oscommands.NewFakeRunner(t).ExpectGitArgs(s.expected, "", nil) runner := oscommands.NewFakeRunner(t).ExpectGitArgs(s.expected, "", nil)
repoPaths := RepoPaths{ repoPaths := RepoPaths{

View file

@ -100,15 +100,19 @@ type FileStatus struct {
PreviousName string PreviousName string
} }
func (c *FileLoader) gitStatus(opts GitStatusOptions) ([]FileStatus, error) { func (self *FileLoader) gitStatus(opts GitStatusOptions) ([]FileStatus, error) {
cmdArgs := NewGitCmd("status"). cmdArgs := NewGitCmd("status").
Arg(opts.UntrackedFilesArg). Arg(opts.UntrackedFilesArg).
Arg("--porcelain"). Arg("--porcelain").
Arg("-z"). Arg("-z").
ArgIf(opts.NoRenames, "--no-renames"). ArgIfElse(
opts.NoRenames,
"--no-renames",
fmt.Sprintf("--find-renames=%d%%", self.AppState.RenameSimilarityThreshold),
).
ToArgv() ToArgv()
statusLines, _, err := c.cmd.New(cmdArgs).DontLog().RunWithOutputs() statusLines, _, err := self.cmd.New(cmdArgs).DontLog().RunWithOutputs()
if err != nil { if err != nil {
return []FileStatus{}, err return []FileStatus{}, err
} }

View file

@ -5,27 +5,31 @@ import (
"github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/commands/oscommands" "github.com/jesseduffield/lazygit/pkg/commands/oscommands"
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
func TestFileGetStatusFiles(t *testing.T) { func TestFileGetStatusFiles(t *testing.T) {
type scenario struct { type scenario struct {
testName string testName string
runner oscommands.ICmdObjRunner similarityThreshold int
expectedFiles []*models.File runner oscommands.ICmdObjRunner
expectedFiles []*models.File
} }
scenarios := []scenario{ scenarios := []scenario{
{ {
"No files found", "No files found",
50,
oscommands.NewFakeRunner(t). oscommands.NewFakeRunner(t).
ExpectGitArgs([]string{"status", "--untracked-files=yes", "--porcelain", "-z"}, "", nil), ExpectGitArgs([]string{"status", "--untracked-files=yes", "--porcelain", "-z", "--find-renames=50%"}, "", nil),
[]*models.File{}, []*models.File{},
}, },
{ {
"Several files found", "Several files found",
50,
oscommands.NewFakeRunner(t). oscommands.NewFakeRunner(t).
ExpectGitArgs([]string{"status", "--untracked-files=yes", "--porcelain", "-z"}, ExpectGitArgs([]string{"status", "--untracked-files=yes", "--porcelain", "-z", "--find-renames=50%"},
"MM file1.txt\x00A file3.txt\x00AM file2.txt\x00?? file4.txt\x00UU file5.txt", "MM file1.txt\x00A file3.txt\x00AM file2.txt\x00?? file4.txt\x00UU file5.txt",
nil, nil,
), ),
@ -94,8 +98,9 @@ func TestFileGetStatusFiles(t *testing.T) {
}, },
{ {
"File with new line char", "File with new line char",
50,
oscommands.NewFakeRunner(t). oscommands.NewFakeRunner(t).
ExpectGitArgs([]string{"status", "--untracked-files=yes", "--porcelain", "-z"}, "MM a\nb.txt", nil), ExpectGitArgs([]string{"status", "--untracked-files=yes", "--porcelain", "-z", "--find-renames=50%"}, "MM a\nb.txt", nil),
[]*models.File{ []*models.File{
{ {
Name: "a\nb.txt", Name: "a\nb.txt",
@ -113,8 +118,9 @@ func TestFileGetStatusFiles(t *testing.T) {
}, },
{ {
"Renamed files", "Renamed files",
50,
oscommands.NewFakeRunner(t). oscommands.NewFakeRunner(t).
ExpectGitArgs([]string{"status", "--untracked-files=yes", "--porcelain", "-z"}, ExpectGitArgs([]string{"status", "--untracked-files=yes", "--porcelain", "-z", "--find-renames=50%"},
"R after1.txt\x00before1.txt\x00RM after2.txt\x00before2.txt", "R after1.txt\x00before1.txt\x00RM after2.txt\x00before2.txt",
nil, nil,
), ),
@ -149,8 +155,9 @@ func TestFileGetStatusFiles(t *testing.T) {
}, },
{ {
"File with arrow in name", "File with arrow in name",
50,
oscommands.NewFakeRunner(t). oscommands.NewFakeRunner(t).
ExpectGitArgs([]string{"status", "--untracked-files=yes", "--porcelain", "-z"}, ExpectGitArgs([]string{"status", "--untracked-files=yes", "--porcelain", "-z", "--find-renames=50%"},
`?? a -> b.txt`, `?? a -> b.txt`,
nil, nil,
), ),
@ -175,8 +182,11 @@ func TestFileGetStatusFiles(t *testing.T) {
t.Run(s.testName, func(t *testing.T) { t.Run(s.testName, func(t *testing.T) {
cmd := oscommands.NewDummyCmdObjBuilder(s.runner) cmd := oscommands.NewDummyCmdObjBuilder(s.runner)
appState := &config.AppState{}
appState.RenameSimilarityThreshold = s.similarityThreshold
loader := &FileLoader{ loader := &FileLoader{
GitCommon: buildGitCommon(commonDeps{}), GitCommon: buildGitCommon(commonDeps{appState: appState}),
cmd: cmd, cmd: cmd,
config: &FakeFileLoaderConfig{showUntrackedFiles: "yes"}, config: &FakeFileLoaderConfig{showUntrackedFiles: "yes"},
getFileType: func(string) string { return "file" }, getFileType: func(string) string { return "file" },

View file

@ -87,6 +87,7 @@ func (self *StashCommands) ShowStashEntryCmdObj(index int) oscommands.ICmdObj {
Arg(fmt.Sprintf("--color=%s", self.UserConfig.Git.Paging.ColorArg)). Arg(fmt.Sprintf("--color=%s", self.UserConfig.Git.Paging.ColorArg)).
Arg(fmt.Sprintf("--unified=%d", self.AppState.DiffContextSize)). Arg(fmt.Sprintf("--unified=%d", self.AppState.DiffContextSize)).
ArgIf(self.AppState.IgnoreWhitespaceInDiffView, "--ignore-all-space"). ArgIf(self.AppState.IgnoreWhitespaceInDiffView, "--ignore-all-space").
Arg(fmt.Sprintf("--find-renames=%d%%", self.AppState.RenameSimilarityThreshold)).
Arg(fmt.Sprintf("stash@{%d}", index)). Arg(fmt.Sprintf("stash@{%d}", index)).
Dir(self.repoPaths.worktreePath). Dir(self.repoPaths.worktreePath).
ToArgv() ToArgv()

View file

@ -98,34 +98,46 @@ func TestStashHash(t *testing.T) {
func TestStashStashEntryCmdObj(t *testing.T) { func TestStashStashEntryCmdObj(t *testing.T) {
type scenario struct { type scenario struct {
testName string testName string
index int index int
contextSize int contextSize int
ignoreWhitespace bool similarityThreshold int
expected []string ignoreWhitespace bool
expected []string
} }
scenarios := []scenario{ scenarios := []scenario{
{ {
testName: "Default case", testName: "Default case",
index: 5, index: 5,
contextSize: 3, contextSize: 3,
ignoreWhitespace: false, similarityThreshold: 50,
expected: []string{"git", "-C", "/path/to/worktree", "stash", "show", "-p", "--stat", "--color=always", "--unified=3", "stash@{5}"}, ignoreWhitespace: false,
expected: []string{"git", "-C", "/path/to/worktree", "stash", "show", "-p", "--stat", "--color=always", "--unified=3", "--find-renames=50%", "stash@{5}"},
}, },
{ {
testName: "Show diff with custom context size", testName: "Show diff with custom context size",
index: 5, index: 5,
contextSize: 77, contextSize: 77,
ignoreWhitespace: false, similarityThreshold: 50,
expected: []string{"git", "-C", "/path/to/worktree", "stash", "show", "-p", "--stat", "--color=always", "--unified=77", "stash@{5}"}, ignoreWhitespace: false,
expected: []string{"git", "-C", "/path/to/worktree", "stash", "show", "-p", "--stat", "--color=always", "--unified=77", "--find-renames=50%", "stash@{5}"},
}, },
{ {
testName: "Default case", testName: "Show diff with custom similarity threshold",
index: 5, index: 5,
contextSize: 3, contextSize: 3,
ignoreWhitespace: true, similarityThreshold: 33,
expected: []string{"git", "-C", "/path/to/worktree", "stash", "show", "-p", "--stat", "--color=always", "--unified=3", "--ignore-all-space", "stash@{5}"}, ignoreWhitespace: false,
expected: []string{"git", "-C", "/path/to/worktree", "stash", "show", "-p", "--stat", "--color=always", "--unified=3", "--find-renames=33%", "stash@{5}"},
},
{
testName: "Default case",
index: 5,
contextSize: 3,
similarityThreshold: 50,
ignoreWhitespace: true,
expected: []string{"git", "-C", "/path/to/worktree", "stash", "show", "-p", "--stat", "--color=always", "--unified=3", "--ignore-all-space", "--find-renames=50%", "stash@{5}"},
}, },
} }
@ -135,6 +147,7 @@ func TestStashStashEntryCmdObj(t *testing.T) {
appState := &config.AppState{} appState := &config.AppState{}
appState.IgnoreWhitespaceInDiffView = s.ignoreWhitespace appState.IgnoreWhitespaceInDiffView = s.ignoreWhitespace
appState.DiffContextSize = s.contextSize appState.DiffContextSize = s.contextSize
appState.RenameSimilarityThreshold = s.similarityThreshold
repoPaths := RepoPaths{ repoPaths := RepoPaths{
worktreePath: "/path/to/worktree", worktreePath: "/path/to/worktree",
} }

View file

@ -263,6 +263,7 @@ func (self *WorkingTreeCommands) WorktreeFileDiffCmdObj(node models.IFile, plain
Arg(fmt.Sprintf("--unified=%d", contextSize)). Arg(fmt.Sprintf("--unified=%d", contextSize)).
Arg(fmt.Sprintf("--color=%s", colorArg)). Arg(fmt.Sprintf("--color=%s", colorArg)).
ArgIf(!plain && self.AppState.IgnoreWhitespaceInDiffView, "--ignore-all-space"). ArgIf(!plain && self.AppState.IgnoreWhitespaceInDiffView, "--ignore-all-space").
Arg(fmt.Sprintf("--find-renames=%d%%", self.AppState.RenameSimilarityThreshold)).
ArgIf(cached, "--cached"). ArgIf(cached, "--cached").
ArgIf(noIndex, "--no-index"). ArgIf(noIndex, "--no-index").
Arg("--"). Arg("--").

View file

@ -205,13 +205,14 @@ func TestWorkingTreeDiscardAllFileChanges(t *testing.T) {
func TestWorkingTreeDiff(t *testing.T) { func TestWorkingTreeDiff(t *testing.T) {
type scenario struct { type scenario struct {
testName string testName string
file *models.File file *models.File
plain bool plain bool
cached bool cached bool
ignoreWhitespace bool ignoreWhitespace bool
contextSize int contextSize int
runner *oscommands.FakeCmdObjRunner similarityThreshold int
runner *oscommands.FakeCmdObjRunner
} }
const expectedResult = "pretend this is an actual git diff" const expectedResult = "pretend this is an actual git diff"
@ -224,12 +225,13 @@ func TestWorkingTreeDiff(t *testing.T) {
HasStagedChanges: false, HasStagedChanges: false,
Tracked: true, Tracked: true,
}, },
plain: false, plain: false,
cached: false, cached: false,
ignoreWhitespace: false, ignoreWhitespace: false,
contextSize: 3, contextSize: 3,
similarityThreshold: 50,
runner: oscommands.NewFakeRunner(t). runner: oscommands.NewFakeRunner(t).
ExpectGitArgs([]string{"-C", "/path/to/worktree", "diff", "--no-ext-diff", "--submodule", "--unified=3", "--color=always", "--", "test.txt"}, expectedResult, nil), ExpectGitArgs([]string{"-C", "/path/to/worktree", "diff", "--no-ext-diff", "--submodule", "--unified=3", "--color=always", "--find-renames=50%", "--", "test.txt"}, expectedResult, nil),
}, },
{ {
testName: "cached", testName: "cached",
@ -238,12 +240,13 @@ func TestWorkingTreeDiff(t *testing.T) {
HasStagedChanges: false, HasStagedChanges: false,
Tracked: true, Tracked: true,
}, },
plain: false, plain: false,
cached: true, cached: true,
ignoreWhitespace: false, ignoreWhitespace: false,
contextSize: 3, contextSize: 3,
similarityThreshold: 50,
runner: oscommands.NewFakeRunner(t). runner: oscommands.NewFakeRunner(t).
ExpectGitArgs([]string{"-C", "/path/to/worktree", "diff", "--no-ext-diff", "--submodule", "--unified=3", "--color=always", "--cached", "--", "test.txt"}, expectedResult, nil), ExpectGitArgs([]string{"-C", "/path/to/worktree", "diff", "--no-ext-diff", "--submodule", "--unified=3", "--color=always", "--find-renames=50%", "--cached", "--", "test.txt"}, expectedResult, nil),
}, },
{ {
testName: "plain", testName: "plain",
@ -252,12 +255,13 @@ func TestWorkingTreeDiff(t *testing.T) {
HasStagedChanges: false, HasStagedChanges: false,
Tracked: true, Tracked: true,
}, },
plain: true, plain: true,
cached: false, cached: false,
ignoreWhitespace: false, ignoreWhitespace: false,
contextSize: 3, contextSize: 3,
similarityThreshold: 50,
runner: oscommands.NewFakeRunner(t). runner: oscommands.NewFakeRunner(t).
ExpectGitArgs([]string{"-C", "/path/to/worktree", "diff", "--no-ext-diff", "--submodule", "--unified=3", "--color=never", "--", "test.txt"}, expectedResult, nil), ExpectGitArgs([]string{"-C", "/path/to/worktree", "diff", "--no-ext-diff", "--submodule", "--unified=3", "--color=never", "--find-renames=50%", "--", "test.txt"}, expectedResult, nil),
}, },
{ {
testName: "File not tracked and file has no staged changes", testName: "File not tracked and file has no staged changes",
@ -266,12 +270,13 @@ func TestWorkingTreeDiff(t *testing.T) {
HasStagedChanges: false, HasStagedChanges: false,
Tracked: false, Tracked: false,
}, },
plain: false, plain: false,
cached: false, cached: false,
ignoreWhitespace: false, ignoreWhitespace: false,
contextSize: 3, contextSize: 3,
similarityThreshold: 50,
runner: oscommands.NewFakeRunner(t). runner: oscommands.NewFakeRunner(t).
ExpectGitArgs([]string{"-C", "/path/to/worktree", "diff", "--no-ext-diff", "--submodule", "--unified=3", "--color=always", "--no-index", "--", "/dev/null", "test.txt"}, expectedResult, nil), ExpectGitArgs([]string{"-C", "/path/to/worktree", "diff", "--no-ext-diff", "--submodule", "--unified=3", "--color=always", "--find-renames=50%", "--no-index", "--", "/dev/null", "test.txt"}, expectedResult, nil),
}, },
{ {
testName: "Default case (ignore whitespace)", testName: "Default case (ignore whitespace)",
@ -280,12 +285,13 @@ func TestWorkingTreeDiff(t *testing.T) {
HasStagedChanges: false, HasStagedChanges: false,
Tracked: true, Tracked: true,
}, },
plain: false, plain: false,
cached: false, cached: false,
ignoreWhitespace: true, ignoreWhitespace: true,
contextSize: 3, contextSize: 3,
similarityThreshold: 50,
runner: oscommands.NewFakeRunner(t). runner: oscommands.NewFakeRunner(t).
ExpectGitArgs([]string{"-C", "/path/to/worktree", "diff", "--no-ext-diff", "--submodule", "--unified=3", "--color=always", "--ignore-all-space", "--", "test.txt"}, expectedResult, nil), ExpectGitArgs([]string{"-C", "/path/to/worktree", "diff", "--no-ext-diff", "--submodule", "--unified=3", "--color=always", "--ignore-all-space", "--find-renames=50%", "--", "test.txt"}, expectedResult, nil),
}, },
{ {
testName: "Show diff with custom context size", testName: "Show diff with custom context size",
@ -294,12 +300,28 @@ func TestWorkingTreeDiff(t *testing.T) {
HasStagedChanges: false, HasStagedChanges: false,
Tracked: true, Tracked: true,
}, },
plain: false, plain: false,
cached: false, cached: false,
ignoreWhitespace: false, ignoreWhitespace: false,
contextSize: 17, contextSize: 17,
similarityThreshold: 50,
runner: oscommands.NewFakeRunner(t). runner: oscommands.NewFakeRunner(t).
ExpectGitArgs([]string{"-C", "/path/to/worktree", "diff", "--no-ext-diff", "--submodule", "--unified=17", "--color=always", "--", "test.txt"}, expectedResult, nil), ExpectGitArgs([]string{"-C", "/path/to/worktree", "diff", "--no-ext-diff", "--submodule", "--unified=17", "--color=always", "--find-renames=50%", "--", "test.txt"}, expectedResult, nil),
},
{
testName: "Show diff with custom similarity threshold",
file: &models.File{
Name: "test.txt",
HasStagedChanges: false,
Tracked: true,
},
plain: false,
cached: false,
ignoreWhitespace: false,
contextSize: 3,
similarityThreshold: 33,
runner: oscommands.NewFakeRunner(t).
ExpectGitArgs([]string{"-C", "/path/to/worktree", "diff", "--no-ext-diff", "--submodule", "--unified=3", "--color=always", "--find-renames=33%", "--", "test.txt"}, expectedResult, nil),
}, },
} }
@ -309,6 +331,7 @@ func TestWorkingTreeDiff(t *testing.T) {
appState := &config.AppState{} appState := &config.AppState{}
appState.IgnoreWhitespaceInDiffView = s.ignoreWhitespace appState.IgnoreWhitespaceInDiffView = s.ignoreWhitespace
appState.DiffContextSize = s.contextSize appState.DiffContextSize = s.contextSize
appState.RenameSimilarityThreshold = s.similarityThreshold
repoPaths := RepoPaths{ repoPaths := RepoPaths{
worktreePath: "/path/to/worktree", worktreePath: "/path/to/worktree",
} }

View file

@ -370,6 +370,7 @@ type AppState struct {
HideCommandLog bool HideCommandLog bool
IgnoreWhitespaceInDiffView bool IgnoreWhitespaceInDiffView bool
DiffContextSize int DiffContextSize int
RenameSimilarityThreshold int
LocalBranchSortOrder string LocalBranchSortOrder string
RemoteBranchSortOrder string RemoteBranchSortOrder string
@ -385,15 +386,16 @@ type AppState struct {
func getDefaultAppState() *AppState { func getDefaultAppState() *AppState {
return &AppState{ return &AppState{
LastUpdateCheck: 0, LastUpdateCheck: 0,
RecentRepos: []string{}, RecentRepos: []string{},
StartupPopupVersion: 0, StartupPopupVersion: 0,
LastVersion: "", LastVersion: "",
DiffContextSize: 3, DiffContextSize: 3,
LocalBranchSortOrder: "recency", RenameSimilarityThreshold: 50,
RemoteBranchSortOrder: "alphabetical", LocalBranchSortOrder: "recency",
GitLogOrder: "", // should be "topo-order" eventually RemoteBranchSortOrder: "alphabetical",
GitLogShowGraph: "", // should be "always" eventually GitLogOrder: "", // should be "topo-order" eventually
GitLogShowGraph: "", // should be "always" eventually
} }
} }

View file

@ -341,73 +341,75 @@ type KeybindingConfig struct {
// damn looks like we have some inconsistencies here with -alt and -alt1 // damn looks like we have some inconsistencies here with -alt and -alt1
type KeybindingUniversalConfig struct { type KeybindingUniversalConfig struct {
Quit string `yaml:"quit"` Quit string `yaml:"quit"`
QuitAlt1 string `yaml:"quit-alt1"` QuitAlt1 string `yaml:"quit-alt1"`
Return string `yaml:"return"` Return string `yaml:"return"`
QuitWithoutChangingDirectory string `yaml:"quitWithoutChangingDirectory"` QuitWithoutChangingDirectory string `yaml:"quitWithoutChangingDirectory"`
TogglePanel string `yaml:"togglePanel"` TogglePanel string `yaml:"togglePanel"`
PrevItem string `yaml:"prevItem"` PrevItem string `yaml:"prevItem"`
NextItem string `yaml:"nextItem"` NextItem string `yaml:"nextItem"`
PrevItemAlt string `yaml:"prevItem-alt"` PrevItemAlt string `yaml:"prevItem-alt"`
NextItemAlt string `yaml:"nextItem-alt"` NextItemAlt string `yaml:"nextItem-alt"`
PrevPage string `yaml:"prevPage"` PrevPage string `yaml:"prevPage"`
NextPage string `yaml:"nextPage"` NextPage string `yaml:"nextPage"`
ScrollLeft string `yaml:"scrollLeft"` ScrollLeft string `yaml:"scrollLeft"`
ScrollRight string `yaml:"scrollRight"` ScrollRight string `yaml:"scrollRight"`
GotoTop string `yaml:"gotoTop"` GotoTop string `yaml:"gotoTop"`
GotoBottom string `yaml:"gotoBottom"` GotoBottom string `yaml:"gotoBottom"`
ToggleRangeSelect string `yaml:"toggleRangeSelect"` ToggleRangeSelect string `yaml:"toggleRangeSelect"`
RangeSelectDown string `yaml:"rangeSelectDown"` RangeSelectDown string `yaml:"rangeSelectDown"`
RangeSelectUp string `yaml:"rangeSelectUp"` RangeSelectUp string `yaml:"rangeSelectUp"`
PrevBlock string `yaml:"prevBlock"` PrevBlock string `yaml:"prevBlock"`
NextBlock string `yaml:"nextBlock"` NextBlock string `yaml:"nextBlock"`
PrevBlockAlt string `yaml:"prevBlock-alt"` PrevBlockAlt string `yaml:"prevBlock-alt"`
NextBlockAlt string `yaml:"nextBlock-alt"` NextBlockAlt string `yaml:"nextBlock-alt"`
NextBlockAlt2 string `yaml:"nextBlock-alt2"` NextBlockAlt2 string `yaml:"nextBlock-alt2"`
PrevBlockAlt2 string `yaml:"prevBlock-alt2"` PrevBlockAlt2 string `yaml:"prevBlock-alt2"`
JumpToBlock []string `yaml:"jumpToBlock"` JumpToBlock []string `yaml:"jumpToBlock"`
NextMatch string `yaml:"nextMatch"` NextMatch string `yaml:"nextMatch"`
PrevMatch string `yaml:"prevMatch"` PrevMatch string `yaml:"prevMatch"`
StartSearch string `yaml:"startSearch"` StartSearch string `yaml:"startSearch"`
OptionMenu string `yaml:"optionMenu"` OptionMenu string `yaml:"optionMenu"`
OptionMenuAlt1 string `yaml:"optionMenu-alt1"` OptionMenuAlt1 string `yaml:"optionMenu-alt1"`
Select string `yaml:"select"` Select string `yaml:"select"`
GoInto string `yaml:"goInto"` GoInto string `yaml:"goInto"`
Confirm string `yaml:"confirm"` Confirm string `yaml:"confirm"`
ConfirmInEditor string `yaml:"confirmInEditor"` ConfirmInEditor string `yaml:"confirmInEditor"`
Remove string `yaml:"remove"` Remove string `yaml:"remove"`
New string `yaml:"new"` New string `yaml:"new"`
Edit string `yaml:"edit"` Edit string `yaml:"edit"`
OpenFile string `yaml:"openFile"` OpenFile string `yaml:"openFile"`
ScrollUpMain string `yaml:"scrollUpMain"` ScrollUpMain string `yaml:"scrollUpMain"`
ScrollDownMain string `yaml:"scrollDownMain"` ScrollDownMain string `yaml:"scrollDownMain"`
ScrollUpMainAlt1 string `yaml:"scrollUpMain-alt1"` ScrollUpMainAlt1 string `yaml:"scrollUpMain-alt1"`
ScrollDownMainAlt1 string `yaml:"scrollDownMain-alt1"` ScrollDownMainAlt1 string `yaml:"scrollDownMain-alt1"`
ScrollUpMainAlt2 string `yaml:"scrollUpMain-alt2"` ScrollUpMainAlt2 string `yaml:"scrollUpMain-alt2"`
ScrollDownMainAlt2 string `yaml:"scrollDownMain-alt2"` ScrollDownMainAlt2 string `yaml:"scrollDownMain-alt2"`
ExecuteCustomCommand string `yaml:"executeCustomCommand"` ExecuteCustomCommand string `yaml:"executeCustomCommand"`
CreateRebaseOptionsMenu string `yaml:"createRebaseOptionsMenu"` CreateRebaseOptionsMenu string `yaml:"createRebaseOptionsMenu"`
Push string `yaml:"pushFiles"` // 'Files' appended for legacy reasons Push string `yaml:"pushFiles"` // 'Files' appended for legacy reasons
Pull string `yaml:"pullFiles"` // 'Files' appended for legacy reasons Pull string `yaml:"pullFiles"` // 'Files' appended for legacy reasons
Refresh string `yaml:"refresh"` Refresh string `yaml:"refresh"`
CreatePatchOptionsMenu string `yaml:"createPatchOptionsMenu"` CreatePatchOptionsMenu string `yaml:"createPatchOptionsMenu"`
NextTab string `yaml:"nextTab"` NextTab string `yaml:"nextTab"`
PrevTab string `yaml:"prevTab"` PrevTab string `yaml:"prevTab"`
NextScreenMode string `yaml:"nextScreenMode"` NextScreenMode string `yaml:"nextScreenMode"`
PrevScreenMode string `yaml:"prevScreenMode"` PrevScreenMode string `yaml:"prevScreenMode"`
Undo string `yaml:"undo"` Undo string `yaml:"undo"`
Redo string `yaml:"redo"` Redo string `yaml:"redo"`
FilteringMenu string `yaml:"filteringMenu"` FilteringMenu string `yaml:"filteringMenu"`
DiffingMenu string `yaml:"diffingMenu"` DiffingMenu string `yaml:"diffingMenu"`
DiffingMenuAlt string `yaml:"diffingMenu-alt"` DiffingMenuAlt string `yaml:"diffingMenu-alt"`
CopyToClipboard string `yaml:"copyToClipboard"` CopyToClipboard string `yaml:"copyToClipboard"`
OpenRecentRepos string `yaml:"openRecentRepos"` OpenRecentRepos string `yaml:"openRecentRepos"`
SubmitEditorText string `yaml:"submitEditorText"` SubmitEditorText string `yaml:"submitEditorText"`
ExtrasMenu string `yaml:"extrasMenu"` ExtrasMenu string `yaml:"extrasMenu"`
ToggleWhitespaceInDiffView string `yaml:"toggleWhitespaceInDiffView"` ToggleWhitespaceInDiffView string `yaml:"toggleWhitespaceInDiffView"`
IncreaseContextInDiffView string `yaml:"increaseContextInDiffView"` IncreaseContextInDiffView string `yaml:"increaseContextInDiffView"`
DecreaseContextInDiffView string `yaml:"decreaseContextInDiffView"` DecreaseContextInDiffView string `yaml:"decreaseContextInDiffView"`
OpenDiffTool string `yaml:"openDiffTool"` IncreaseRenameSimilarityThreshold string `yaml:"increaseRenameSimilarityThreshold"`
DecreaseRenameSimilarityThreshold string `yaml:"decreaseRenameSimilarityThreshold"`
OpenDiffTool string `yaml:"openDiffTool"`
} }
type KeybindingStatusConfig struct { type KeybindingStatusConfig struct {
@ -777,73 +779,75 @@ func GetDefaultConfig() *UserConfig {
PromptToReturnFromSubprocess: true, PromptToReturnFromSubprocess: true,
Keybinding: KeybindingConfig{ Keybinding: KeybindingConfig{
Universal: KeybindingUniversalConfig{ Universal: KeybindingUniversalConfig{
Quit: "q", Quit: "q",
QuitAlt1: "<c-c>", QuitAlt1: "<c-c>",
Return: "<esc>", Return: "<esc>",
QuitWithoutChangingDirectory: "Q", QuitWithoutChangingDirectory: "Q",
TogglePanel: "<tab>", TogglePanel: "<tab>",
PrevItem: "<up>", PrevItem: "<up>",
NextItem: "<down>", NextItem: "<down>",
PrevItemAlt: "k", PrevItemAlt: "k",
NextItemAlt: "j", NextItemAlt: "j",
PrevPage: ",", PrevPage: ",",
NextPage: ".", NextPage: ".",
ScrollLeft: "H", ScrollLeft: "H",
ScrollRight: "L", ScrollRight: "L",
GotoTop: "<", GotoTop: "<",
GotoBottom: ">", GotoBottom: ">",
ToggleRangeSelect: "v", ToggleRangeSelect: "v",
RangeSelectDown: "<s-down>", RangeSelectDown: "<s-down>",
RangeSelectUp: "<s-up>", RangeSelectUp: "<s-up>",
PrevBlock: "<left>", PrevBlock: "<left>",
NextBlock: "<right>", NextBlock: "<right>",
PrevBlockAlt: "h", PrevBlockAlt: "h",
NextBlockAlt: "l", NextBlockAlt: "l",
PrevBlockAlt2: "<backtab>", PrevBlockAlt2: "<backtab>",
NextBlockAlt2: "<tab>", NextBlockAlt2: "<tab>",
JumpToBlock: []string{"1", "2", "3", "4", "5"}, JumpToBlock: []string{"1", "2", "3", "4", "5"},
NextMatch: "n", NextMatch: "n",
PrevMatch: "N", PrevMatch: "N",
StartSearch: "/", StartSearch: "/",
OptionMenu: "<disabled>", OptionMenu: "<disabled>",
OptionMenuAlt1: "?", OptionMenuAlt1: "?",
Select: "<space>", Select: "<space>",
GoInto: "<enter>", GoInto: "<enter>",
Confirm: "<enter>", Confirm: "<enter>",
ConfirmInEditor: "<a-enter>", ConfirmInEditor: "<a-enter>",
Remove: "d", Remove: "d",
New: "n", New: "n",
Edit: "e", Edit: "e",
OpenFile: "o", OpenFile: "o",
OpenRecentRepos: "<c-r>", OpenRecentRepos: "<c-r>",
ScrollUpMain: "<pgup>", ScrollUpMain: "<pgup>",
ScrollDownMain: "<pgdown>", ScrollDownMain: "<pgdown>",
ScrollUpMainAlt1: "K", ScrollUpMainAlt1: "K",
ScrollDownMainAlt1: "J", ScrollDownMainAlt1: "J",
ScrollUpMainAlt2: "<c-u>", ScrollUpMainAlt2: "<c-u>",
ScrollDownMainAlt2: "<c-d>", ScrollDownMainAlt2: "<c-d>",
ExecuteCustomCommand: ":", ExecuteCustomCommand: ":",
CreateRebaseOptionsMenu: "m", CreateRebaseOptionsMenu: "m",
Push: "P", Push: "P",
Pull: "p", Pull: "p",
Refresh: "R", Refresh: "R",
CreatePatchOptionsMenu: "<c-p>", CreatePatchOptionsMenu: "<c-p>",
NextTab: "]", NextTab: "]",
PrevTab: "[", PrevTab: "[",
NextScreenMode: "+", NextScreenMode: "+",
PrevScreenMode: "_", PrevScreenMode: "_",
Undo: "z", Undo: "z",
Redo: "<c-z>", Redo: "<c-z>",
FilteringMenu: "<c-s>", FilteringMenu: "<c-s>",
DiffingMenu: "W", DiffingMenu: "W",
DiffingMenuAlt: "<c-e>", DiffingMenuAlt: "<c-e>",
CopyToClipboard: "<c-o>", CopyToClipboard: "<c-o>",
SubmitEditorText: "<enter>", SubmitEditorText: "<enter>",
ExtrasMenu: "@", ExtrasMenu: "@",
ToggleWhitespaceInDiffView: "<c-w>", ToggleWhitespaceInDiffView: "<c-w>",
IncreaseContextInDiffView: "}", IncreaseContextInDiffView: "}",
DecreaseContextInDiffView: "{", DecreaseContextInDiffView: "{",
OpenDiffTool: "<c-t>", IncreaseRenameSimilarityThreshold: ")",
DecreaseRenameSimilarityThreshold: "(",
OpenDiffTool: "<c-t>",
}, },
Status: KeybindingStatusConfig{ Status: KeybindingStatusConfig{
CheckForUpdate: "u", CheckForUpdate: "u",

View file

@ -179,6 +179,7 @@ func (gui *Gui) resetHelpersAndControllers() {
undoController := controllers.NewUndoController(common) undoController := controllers.NewUndoController(common)
globalController := controllers.NewGlobalController(common) globalController := controllers.NewGlobalController(common)
contextLinesController := controllers.NewContextLinesController(common) contextLinesController := controllers.NewContextLinesController(common)
renameSimilarityThresholdController := controllers.NewRenameSimilarityThresholdController(common)
verticalScrollControllerFactory := controllers.NewVerticalScrollControllerFactory(common, &gui.viewBufferManagerMap) verticalScrollControllerFactory := controllers.NewVerticalScrollControllerFactory(common, &gui.viewBufferManagerMap)
branchesController := controllers.NewBranchesController(common) branchesController := controllers.NewBranchesController(common)
@ -383,6 +384,7 @@ func (gui *Gui) resetHelpersAndControllers() {
undoController, undoController,
globalController, globalController,
contextLinesController, contextLinesController,
renameSimilarityThresholdController,
jumpToSideWindowController, jumpToSideWindowController,
syncController, syncController,
) )

View file

@ -0,0 +1,100 @@
package controllers
import (
"fmt"
"github.com/jesseduffield/lazygit/pkg/gui/context"
"github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/samber/lo"
)
// This controller lets you change the similarity threshold for detecting renames.
var CONTEXT_KEYS_SHOWING_RENAMES = []types.ContextKey{
context.FILES_CONTEXT_KEY,
context.SUB_COMMITS_CONTEXT_KEY,
context.LOCAL_COMMITS_CONTEXT_KEY,
context.STASH_CONTEXT_KEY,
}
type RenameSimilarityThresholdController struct {
baseController
c *ControllerCommon
}
var _ types.IController = &RenameSimilarityThresholdController{}
func NewRenameSimilarityThresholdController(
common *ControllerCommon,
) *RenameSimilarityThresholdController {
return &RenameSimilarityThresholdController{
baseController: baseController{},
c: common,
}
}
func (self *RenameSimilarityThresholdController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.IncreaseRenameSimilarityThreshold),
Handler: self.Increase,
Description: self.c.Tr.IncreaseRenameSimilarityThreshold,
Tooltip: self.c.Tr.IncreaseRenameSimilarityThresholdTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.DecreaseRenameSimilarityThreshold),
Handler: self.Decrease,
Description: self.c.Tr.DecreaseRenameSimilarityThreshold,
Tooltip: self.c.Tr.DecreaseRenameSimilarityThresholdTooltip,
},
}
return bindings
}
func (self *RenameSimilarityThresholdController) Context() types.Context {
return nil
}
func (self *RenameSimilarityThresholdController) Increase() error {
old_size := self.c.AppState.RenameSimilarityThreshold
if self.isShowingRenames() && old_size < 100 {
self.c.AppState.RenameSimilarityThreshold = min(100, old_size+5)
return self.applyChange()
}
return nil
}
func (self *RenameSimilarityThresholdController) Decrease() error {
old_size := self.c.AppState.RenameSimilarityThreshold
if self.isShowingRenames() && old_size > 5 {
self.c.AppState.RenameSimilarityThreshold = max(5, old_size-5)
return self.applyChange()
}
return nil
}
func (self *RenameSimilarityThresholdController) applyChange() error {
self.c.Toast(fmt.Sprintf(self.c.Tr.RenameSimilarityThresholdChanged, self.c.AppState.RenameSimilarityThreshold))
self.c.SaveAppStateAndLogError()
currentContext := self.c.CurrentStaticContext()
switch currentContext.GetKey() {
// we make an exception for our files context, because it actually need to refresh its state afterwards.
case context.FILES_CONTEXT_KEY:
return self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.FILES}})
default:
return currentContext.HandleRenderToMain()
}
}
func (self *RenameSimilarityThresholdController) isShowingRenames() bool {
return lo.Contains(
CONTEXT_KEYS_SHOWING_RENAMES,
self.c.CurrentStaticContext().GetKey(),
)
}

View file

@ -642,163 +642,168 @@ type TranslationSet struct {
NavigationTitle string NavigationTitle string
SuggestionsCheatsheetTitle string SuggestionsCheatsheetTitle string
// Unlike the cheatsheet title above, the real suggestions title has a little message saying press tab to focus // Unlike the cheatsheet title above, the real suggestions title has a little message saying press tab to focus
SuggestionsTitle string SuggestionsTitle string
SuggestionsSubtitle string SuggestionsSubtitle string
ExtrasTitle string ExtrasTitle string
PushingTagStatus string PushingTagStatus string
PullRequestURLCopiedToClipboard string PullRequestURLCopiedToClipboard string
CommitDiffCopiedToClipboard string CommitDiffCopiedToClipboard string
CommitURLCopiedToClipboard string CommitURLCopiedToClipboard string
CommitMessageCopiedToClipboard string CommitMessageCopiedToClipboard string
CommitSubjectCopiedToClipboard string CommitSubjectCopiedToClipboard string
CommitAuthorCopiedToClipboard string CommitAuthorCopiedToClipboard string
PatchCopiedToClipboard string PatchCopiedToClipboard string
CopiedToClipboard string CopiedToClipboard string
ErrCannotEditDirectory string ErrCannotEditDirectory string
ErrStageDirWithInlineMergeConflicts string ErrStageDirWithInlineMergeConflicts string
ErrRepositoryMovedOrDeleted string ErrRepositoryMovedOrDeleted string
ErrWorktreeMovedOrRemoved string ErrWorktreeMovedOrRemoved string
CommandLog string CommandLog string
ToggleShowCommandLog string ToggleShowCommandLog string
FocusCommandLog string FocusCommandLog string
CommandLogHeader string CommandLogHeader string
RandomTip string RandomTip string
SelectParentCommitForMerge string SelectParentCommitForMerge string
ToggleWhitespaceInDiffView string ToggleWhitespaceInDiffView string
ToggleWhitespaceInDiffViewTooltip string ToggleWhitespaceInDiffViewTooltip string
IgnoreWhitespaceDiffViewSubTitle string IgnoreWhitespaceDiffViewSubTitle string
IgnoreWhitespaceNotSupportedHere string IgnoreWhitespaceNotSupportedHere string
IncreaseContextInDiffView string IncreaseContextInDiffView string
IncreaseContextInDiffViewTooltip string IncreaseContextInDiffViewTooltip string
DecreaseContextInDiffView string DecreaseContextInDiffView string
DecreaseContextInDiffViewTooltip string DecreaseContextInDiffViewTooltip string
DiffContextSizeChanged string DiffContextSizeChanged string
CreatePullRequestOptions string IncreaseRenameSimilarityThreshold string
DefaultBranch string IncreaseRenameSimilarityThresholdTooltip string
SelectBranch string DecreaseRenameSimilarityThreshold string
CreatePullRequest string DecreaseRenameSimilarityThresholdTooltip string
SelectConfigFile string RenameSimilarityThresholdChanged string
NoConfigFileFoundErr string CreatePullRequestOptions string
LoadingFileSuggestions string DefaultBranch string
LoadingCommits string SelectBranch string
MustSpecifyOriginError string CreatePullRequest string
GitOutput string SelectConfigFile string
GitCommandFailed string NoConfigFileFoundErr string
AbortTitle string LoadingFileSuggestions string
AbortPrompt string LoadingCommits string
OpenLogMenu string MustSpecifyOriginError string
OpenLogMenuTooltip string GitOutput string
LogMenuTitle string GitCommandFailed string
ToggleShowGitGraphAll string AbortTitle string
ShowGitGraph string AbortPrompt string
SortOrder string OpenLogMenu string
SortAlphabetical string OpenLogMenuTooltip string
SortByDate string LogMenuTitle string
SortByRecency string ToggleShowGitGraphAll string
SortBasedOnReflog string ShowGitGraph string
SortCommits string SortOrder string
CantChangeContextSizeError string SortAlphabetical string
OpenCommitInBrowser string SortByDate string
ViewBisectOptions string SortByRecency string
ConfirmRevertCommit string SortBasedOnReflog string
RewordInEditorTitle string SortCommits string
RewordInEditorPrompt string CantChangeContextSizeError string
CheckoutPrompt string OpenCommitInBrowser string
HardResetAutostashPrompt string ViewBisectOptions string
UpstreamGone string ConfirmRevertCommit string
NukeDescription string RewordInEditorTitle string
DiscardStagedChangesDescription string RewordInEditorPrompt string
EmptyOutput string CheckoutPrompt string
Patch string HardResetAutostashPrompt string
CustomPatch string UpstreamGone string
CommitsCopied string NukeDescription string
CommitCopied string DiscardStagedChangesDescription string
ResetPatch string EmptyOutput string
ResetPatchTooltip string Patch string
ApplyPatch string CustomPatch string
ApplyPatchTooltip string CommitsCopied string
ApplyPatchInReverse string CommitCopied string
ApplyPatchInReverseTooltip string ResetPatch string
RemovePatchFromOriginalCommit string ResetPatchTooltip string
RemovePatchFromOriginalCommitTooltip string ApplyPatch string
MovePatchOutIntoIndex string ApplyPatchTooltip string
MovePatchOutIntoIndexTooltip string ApplyPatchInReverse string
MovePatchIntoNewCommit string ApplyPatchInReverseTooltip string
MovePatchIntoNewCommitTooltip string RemovePatchFromOriginalCommit string
MovePatchToSelectedCommit string RemovePatchFromOriginalCommitTooltip string
MovePatchToSelectedCommitTooltip string MovePatchOutIntoIndex string
CopyPatchToClipboard string MovePatchOutIntoIndexTooltip string
NoMatchesFor string MovePatchIntoNewCommit string
MatchesFor string MovePatchIntoNewCommitTooltip string
SearchKeybindings string MovePatchToSelectedCommit string
SearchPrefix string MovePatchToSelectedCommitTooltip string
FilterPrefix string CopyPatchToClipboard string
ExitSearchMode string NoMatchesFor string
ExitTextFilterMode string MatchesFor string
Switch string SearchKeybindings string
SwitchToWorktree string SearchPrefix string
SwitchToWorktreeTooltip string FilterPrefix string
AlreadyCheckedOutByWorktree string ExitSearchMode string
BranchCheckedOutByWorktree string ExitTextFilterMode string
DetachWorktreeTooltip string Switch string
Switching string SwitchToWorktree string
RemoveWorktree string SwitchToWorktreeTooltip string
RemoveWorktreeTitle string AlreadyCheckedOutByWorktree string
DetachWorktree string BranchCheckedOutByWorktree string
DetachingWorktree string DetachWorktreeTooltip string
WorktreesTitle string Switching string
WorktreeTitle string RemoveWorktree string
RemoveWorktreePrompt string RemoveWorktreeTitle string
ForceRemoveWorktreePrompt string DetachWorktree string
RemovingWorktree string DetachingWorktree string
AddingWorktree string WorktreesTitle string
CantDeleteCurrentWorktree string WorktreeTitle string
AlreadyInWorktree string RemoveWorktreePrompt string
CantDeleteMainWorktree string ForceRemoveWorktreePrompt string
NoWorktreesThisRepo string RemovingWorktree string
MissingWorktree string AddingWorktree string
MainWorktree string CantDeleteCurrentWorktree string
NewWorktree string AlreadyInWorktree string
NewWorktreePath string CantDeleteMainWorktree string
NewWorktreeBase string NoWorktreesThisRepo string
RemoveWorktreeTooltip string MissingWorktree string
BranchNameCannotBeBlank string MainWorktree string
NewBranchName string NewWorktree string
NewBranchNameLeaveBlank string NewWorktreePath string
ViewWorktreeOptions string NewWorktreeBase string
CreateWorktreeFrom string RemoveWorktreeTooltip string
CreateWorktreeFromDetached string BranchNameCannotBeBlank string
LcWorktree string NewBranchName string
ChangingDirectoryTo string NewBranchNameLeaveBlank string
Name string ViewWorktreeOptions string
Branch string CreateWorktreeFrom string
Path string CreateWorktreeFromDetached string
MarkedBaseCommitStatus string LcWorktree string
MarkAsBaseCommit string ChangingDirectoryTo string
MarkAsBaseCommitTooltip string Name string
MarkedCommitMarker string Branch string
PleaseGoToURL string Path string
NoCopiedCommits string MarkedBaseCommitStatus string
DisabledMenuItemPrefix string MarkAsBaseCommit string
QuickStartInteractiveRebase string MarkAsBaseCommitTooltip string
QuickStartInteractiveRebaseTooltip string MarkedCommitMarker string
CannotQuickStartInteractiveRebase string PleaseGoToURL string
ToggleRangeSelect string NoCopiedCommits string
RangeSelectUp string DisabledMenuItemPrefix string
RangeSelectDown string QuickStartInteractiveRebase string
RangeSelectNotSupported string QuickStartInteractiveRebaseTooltip string
NoItemSelected string CannotQuickStartInteractiveRebase string
SelectedItemIsNotABranch string ToggleRangeSelect string
SelectedItemDoesNotHaveFiles string RangeSelectUp string
RangeSelectNotSupportedForSubmodules string RangeSelectDown string
OldCherryPickKeyWarning string RangeSelectNotSupported string
CommandDoesNotSupportOpeningInEditor string NoItemSelected string
Actions Actions SelectedItemIsNotABranch string
Bisect Bisect SelectedItemDoesNotHaveFiles string
Log Log RangeSelectNotSupportedForSubmodules string
BreakingChangesTitle string OldCherryPickKeyWarning string
BreakingChangesMessage string CommandDoesNotSupportOpeningInEditor string
BreakingChangesByVersion map[string]string Actions Actions
Bisect Bisect
Log Log
BreakingChangesTitle string
BreakingChangesMessage string
BreakingChangesByVersion map[string]string
} }
type Bisect struct { type Bisect struct {
@ -1554,219 +1559,224 @@ func EnglishTranslationSet() *TranslationSet {
ViewDiffingOptions: "View diffing options", ViewDiffingOptions: "View diffing options",
ViewDiffingOptionsTooltip: "View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction.", ViewDiffingOptionsTooltip: "View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction.",
// the actual view is the extras view which I intend to give more tabs in future but for now we'll only mention the command log part // the actual view is the extras view which I intend to give more tabs in future but for now we'll only mention the command log part
OpenCommandLogMenu: "View command log options", OpenCommandLogMenu: "View command log options",
OpenCommandLogMenuTooltip: "View options for the command log e.g. show/hide the command log and focus the command log.", OpenCommandLogMenuTooltip: "View options for the command log e.g. show/hide the command log and focus the command log.",
ShowingGitDiff: "Showing output for:", ShowingGitDiff: "Showing output for:",
CommitDiff: "Commit diff", CommitDiff: "Commit diff",
CopyCommitHashToClipboard: "Copy commit hash to clipboard", CopyCommitHashToClipboard: "Copy commit hash to clipboard",
CommitHash: "Commit hash", CommitHash: "Commit hash",
CommitURL: "Commit URL", CommitURL: "Commit URL",
CopyCommitMessageToClipboard: "Copy commit message to clipboard", CopyCommitMessageToClipboard: "Copy commit message to clipboard",
PasteCommitMessageFromClipboard: "Paste commit message from clipboard", PasteCommitMessageFromClipboard: "Paste commit message from clipboard",
SurePasteCommitMessage: "Pasting will overwrite the current commit message, continue?", SurePasteCommitMessage: "Pasting will overwrite the current commit message, continue?",
CommitMessage: "Commit message", CommitMessage: "Commit message",
CommitSubject: "Commit subject", CommitSubject: "Commit subject",
CommitAuthor: "Commit author", CommitAuthor: "Commit author",
CopyCommitAttributeToClipboard: "Copy commit attribute to clipboard", CopyCommitAttributeToClipboard: "Copy commit attribute to clipboard",
CopyCommitAttributeToClipboardTooltip: "Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author).", CopyCommitAttributeToClipboardTooltip: "Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author).",
CopyBranchNameToClipboard: "Copy branch name to clipboard", CopyBranchNameToClipboard: "Copy branch name to clipboard",
CopyPathToClipboard: "Copy path to clipboard", CopyPathToClipboard: "Copy path to clipboard",
CopySelectedTextToClipboard: "Copy selected text to clipboard", CopySelectedTextToClipboard: "Copy selected text to clipboard",
CommitPrefixPatternError: "Error in commitPrefix pattern", CommitPrefixPatternError: "Error in commitPrefix pattern",
NoFilesStagedTitle: "No files staged", NoFilesStagedTitle: "No files staged",
NoFilesStagedPrompt: "You have not staged any files. Commit all files?", NoFilesStagedPrompt: "You have not staged any files. Commit all files?",
BranchNotFoundTitle: "Branch not found", BranchNotFoundTitle: "Branch not found",
BranchNotFoundPrompt: "Branch not found. Create a new branch named", BranchNotFoundPrompt: "Branch not found. Create a new branch named",
BranchUnknown: "Branch unknown", BranchUnknown: "Branch unknown",
DiscardChangeTitle: "Discard change", DiscardChangeTitle: "Discard change",
DiscardChangePrompt: "Are you sure you want to discard this change (git reset)? It is irreversible.\nTo disable this dialogue set the config key of 'gui.skipDiscardChangeWarning' to true", DiscardChangePrompt: "Are you sure you want to discard this change (git reset)? It is irreversible.\nTo disable this dialogue set the config key of 'gui.skipDiscardChangeWarning' to true",
CreateNewBranchFromCommit: "Create new branch off of commit", CreateNewBranchFromCommit: "Create new branch off of commit",
BuildingPatch: "Building patch", BuildingPatch: "Building patch",
ViewCommits: "View commits", ViewCommits: "View commits",
MinGitVersionError: "Git version must be at least 2.20 (i.e. from 2018 onwards). Please upgrade your git version. Alternatively raise an issue at https://github.com/jesseduffield/lazygit/issues for lazygit to be more backwards compatible.", MinGitVersionError: "Git version must be at least 2.20 (i.e. from 2018 onwards). Please upgrade your git version. Alternatively raise an issue at https://github.com/jesseduffield/lazygit/issues for lazygit to be more backwards compatible.",
RunningCustomCommandStatus: "Running custom command", RunningCustomCommandStatus: "Running custom command",
SubmoduleStashAndReset: "Stash uncommitted submodule changes and update", SubmoduleStashAndReset: "Stash uncommitted submodule changes and update",
AndResetSubmodules: "And reset submodules", AndResetSubmodules: "And reset submodules",
Enter: "Enter", Enter: "Enter",
EnterSubmoduleTooltip: "Enter submodule. After entering the submodule, you can press `{{.escape}}` to escape back to the parent repo.", EnterSubmoduleTooltip: "Enter submodule. After entering the submodule, you can press `{{.escape}}` to escape back to the parent repo.",
CopySubmoduleNameToClipboard: "Copy submodule name to clipboard", CopySubmoduleNameToClipboard: "Copy submodule name to clipboard",
RemoveSubmodule: "Remove submodule", RemoveSubmodule: "Remove submodule",
RemoveSubmodulePrompt: "Are you sure you want to remove submodule '%s' and its corresponding directory? This is irreversible.", RemoveSubmodulePrompt: "Are you sure you want to remove submodule '%s' and its corresponding directory? This is irreversible.",
RemoveSubmoduleTooltip: "Remove the selected submodule and its corresponding directory.", RemoveSubmoduleTooltip: "Remove the selected submodule and its corresponding directory.",
ResettingSubmoduleStatus: "Resetting submodule", ResettingSubmoduleStatus: "Resetting submodule",
NewSubmoduleName: "New submodule name:", NewSubmoduleName: "New submodule name:",
NewSubmoduleUrl: "New submodule URL:", NewSubmoduleUrl: "New submodule URL:",
NewSubmodulePath: "New submodule path:", NewSubmodulePath: "New submodule path:",
NewSubmodule: "New submodule", NewSubmodule: "New submodule",
AddingSubmoduleStatus: "Adding submodule", AddingSubmoduleStatus: "Adding submodule",
UpdateSubmoduleUrl: "Update URL for submodule '%s'", UpdateSubmoduleUrl: "Update URL for submodule '%s'",
UpdatingSubmoduleUrlStatus: "Updating URL", UpdatingSubmoduleUrlStatus: "Updating URL",
EditSubmoduleUrl: "Update submodule URL", EditSubmoduleUrl: "Update submodule URL",
InitializingSubmoduleStatus: "Initializing submodule", InitializingSubmoduleStatus: "Initializing submodule",
InitSubmoduleTooltip: "Initialize the selected submodule to prepare for fetching. You probably want to follow this up by invoking the 'update' action to fetch the submodule.", InitSubmoduleTooltip: "Initialize the selected submodule to prepare for fetching. You probably want to follow this up by invoking the 'update' action to fetch the submodule.",
Update: "Update", Update: "Update",
Initialize: "Initialize", Initialize: "Initialize",
SubmoduleUpdateTooltip: "Update selected submodule.", SubmoduleUpdateTooltip: "Update selected submodule.",
UpdatingSubmoduleStatus: "Updating submodule", UpdatingSubmoduleStatus: "Updating submodule",
BulkInitSubmodules: "Bulk init submodules", BulkInitSubmodules: "Bulk init submodules",
BulkUpdateSubmodules: "Bulk update submodules", BulkUpdateSubmodules: "Bulk update submodules",
BulkDeinitSubmodules: "Bulk deinit submodules", BulkDeinitSubmodules: "Bulk deinit submodules",
ViewBulkSubmoduleOptions: "View bulk submodule options", ViewBulkSubmoduleOptions: "View bulk submodule options",
BulkSubmoduleOptions: "Bulk submodule options", BulkSubmoduleOptions: "Bulk submodule options",
RunningCommand: "Running command", RunningCommand: "Running command",
SubCommitsTitle: "Sub-commits", SubCommitsTitle: "Sub-commits",
SubmodulesTitle: "Submodules", SubmodulesTitle: "Submodules",
NavigationTitle: "List panel navigation", NavigationTitle: "List panel navigation",
SuggestionsCheatsheetTitle: "Suggestions", SuggestionsCheatsheetTitle: "Suggestions",
SuggestionsTitle: "Suggestions (press %s to focus)", SuggestionsTitle: "Suggestions (press %s to focus)",
SuggestionsSubtitle: "(press %s to delete, %s to edit)", SuggestionsSubtitle: "(press %s to delete, %s to edit)",
ExtrasTitle: "Command log", ExtrasTitle: "Command log",
PushingTagStatus: "Pushing tag", PushingTagStatus: "Pushing tag",
PullRequestURLCopiedToClipboard: "Pull request URL copied to clipboard", PullRequestURLCopiedToClipboard: "Pull request URL copied to clipboard",
CommitDiffCopiedToClipboard: "Commit diff copied to clipboard", CommitDiffCopiedToClipboard: "Commit diff copied to clipboard",
CommitURLCopiedToClipboard: "Commit URL copied to clipboard", CommitURLCopiedToClipboard: "Commit URL copied to clipboard",
CommitMessageCopiedToClipboard: "Commit message copied to clipboard", CommitMessageCopiedToClipboard: "Commit message copied to clipboard",
CommitSubjectCopiedToClipboard: "Commit subject copied to clipboard", CommitSubjectCopiedToClipboard: "Commit subject copied to clipboard",
CommitAuthorCopiedToClipboard: "Commit author copied to clipboard", CommitAuthorCopiedToClipboard: "Commit author copied to clipboard",
PatchCopiedToClipboard: "Patch copied to clipboard", PatchCopiedToClipboard: "Patch copied to clipboard",
CopiedToClipboard: "copied to clipboard", CopiedToClipboard: "copied to clipboard",
ErrCannotEditDirectory: "Cannot edit directories: you can only edit individual files", ErrCannotEditDirectory: "Cannot edit directories: you can only edit individual files",
ErrStageDirWithInlineMergeConflicts: "Cannot stage/unstage directory containing files with inline merge conflicts. Please fix up the merge conflicts first", ErrStageDirWithInlineMergeConflicts: "Cannot stage/unstage directory containing files with inline merge conflicts. Please fix up the merge conflicts first",
ErrRepositoryMovedOrDeleted: "Cannot find repo. It might have been moved or deleted ¯\\_(ツ)_/¯", ErrRepositoryMovedOrDeleted: "Cannot find repo. It might have been moved or deleted ¯\\_(ツ)_/¯",
CommandLog: "Command log", CommandLog: "Command log",
ErrWorktreeMovedOrRemoved: "Cannot find worktree. It might have been moved or removed ¯\\_(ツ)_/¯", ErrWorktreeMovedOrRemoved: "Cannot find worktree. It might have been moved or removed ¯\\_(ツ)_/¯",
ToggleShowCommandLog: "Toggle show/hide command log", ToggleShowCommandLog: "Toggle show/hide command log",
FocusCommandLog: "Focus command log", FocusCommandLog: "Focus command log",
CommandLogHeader: "You can hide/focus this panel by pressing '%s'\n", CommandLogHeader: "You can hide/focus this panel by pressing '%s'\n",
RandomTip: "Random tip", RandomTip: "Random tip",
SelectParentCommitForMerge: "Select parent commit for merge", SelectParentCommitForMerge: "Select parent commit for merge",
ToggleWhitespaceInDiffView: "Toggle whitespace", ToggleWhitespaceInDiffView: "Toggle whitespace",
ToggleWhitespaceInDiffViewTooltip: "Toggle whether or not whitespace changes are shown in the diff view.", ToggleWhitespaceInDiffViewTooltip: "Toggle whether or not whitespace changes are shown in the diff view.",
IgnoreWhitespaceDiffViewSubTitle: "(ignoring whitespace)", IgnoreWhitespaceDiffViewSubTitle: "(ignoring whitespace)",
IgnoreWhitespaceNotSupportedHere: "Ignoring whitespace is not supported in this view", IgnoreWhitespaceNotSupportedHere: "Ignoring whitespace is not supported in this view",
IncreaseContextInDiffView: "Increase diff context size", IncreaseContextInDiffView: "Increase diff context size",
IncreaseContextInDiffViewTooltip: "Increase the amount of the context shown around changes in the diff view.", IncreaseContextInDiffViewTooltip: "Increase the amount of the context shown around changes in the diff view.",
DecreaseContextInDiffView: "Decrease diff context size", DecreaseContextInDiffView: "Decrease diff context size",
DecreaseContextInDiffViewTooltip: "Decrease the amount of the context shown around changes in the diff view.", DecreaseContextInDiffViewTooltip: "Decrease the amount of the context shown around changes in the diff view.",
DiffContextSizeChanged: "Changed diff context size to %d", DiffContextSizeChanged: "Changed diff context size to %d",
CreatePullRequestOptions: "View create pull request options", IncreaseRenameSimilarityThresholdTooltip: "Increase the similarity threshold for a deletion and addition pair to be treated as a rename.",
DefaultBranch: "Default branch", IncreaseRenameSimilarityThreshold: "Increase rename similarity threshold",
SelectBranch: "Select branch", DecreaseRenameSimilarityThresholdTooltip: "Decrease the similarity threshold for a deletion and addition pair to be treated as a rename.",
SelectConfigFile: "Select config file", DecreaseRenameSimilarityThreshold: "Decrease rename similarity threshold",
NoConfigFileFoundErr: "No config file found", RenameSimilarityThresholdChanged: "Changed rename similarity threshold to %d%%",
LoadingFileSuggestions: "Loading file suggestions", CreatePullRequestOptions: "View create pull request options",
LoadingCommits: "Loading commits", DefaultBranch: "Default branch",
MustSpecifyOriginError: "Must specify a remote if specifying a branch", SelectBranch: "Select branch",
GitOutput: "Git output:", SelectConfigFile: "Select config file",
GitCommandFailed: "Git command failed. Check command log for details (open with %s)", NoConfigFileFoundErr: "No config file found",
AbortTitle: "Abort %s", LoadingFileSuggestions: "Loading file suggestions",
AbortPrompt: "Are you sure you want to abort the current %s?", LoadingCommits: "Loading commits",
OpenLogMenu: "View log options", MustSpecifyOriginError: "Must specify a remote if specifying a branch",
OpenLogMenuTooltip: "View options for commit log e.g. changing sort order, hiding the git graph, showing the whole git graph.", GitOutput: "Git output:",
LogMenuTitle: "Commit Log Options", GitCommandFailed: "Git command failed. Check command log for details (open with %s)",
ToggleShowGitGraphAll: "Toggle show whole git graph (pass the `--all` flag to `git log`)", AbortTitle: "Abort %s",
ShowGitGraph: "Show git graph", AbortPrompt: "Are you sure you want to abort the current %s?",
SortOrder: "Sort order", OpenLogMenu: "View log options",
SortAlphabetical: "Alphabetical", OpenLogMenuTooltip: "View options for commit log e.g. changing sort order, hiding the git graph, showing the whole git graph.",
SortByDate: "Date", LogMenuTitle: "Commit Log Options",
SortByRecency: "Recency", ToggleShowGitGraphAll: "Toggle show whole git graph (pass the `--all` flag to `git log`)",
SortBasedOnReflog: "(based on reflog)", ShowGitGraph: "Show git graph",
SortCommits: "Commit sort order", SortOrder: "Sort order",
CantChangeContextSizeError: "Cannot change context while in patch building mode because we were too lazy to support it when releasing the feature. If you really want it, please let us know!", SortAlphabetical: "Alphabetical",
OpenCommitInBrowser: "Open commit in browser", SortByDate: "Date",
ViewBisectOptions: "View bisect options", SortByRecency: "Recency",
ConfirmRevertCommit: "Are you sure you want to revert {{.selectedCommit}}?", SortBasedOnReflog: "(based on reflog)",
RewordInEditorTitle: "Reword in editor", SortCommits: "Commit sort order",
RewordInEditorPrompt: "Are you sure you want to reword this commit in your editor?", CantChangeContextSizeError: "Cannot change context while in patch building mode because we were too lazy to support it when releasing the feature. If you really want it, please let us know!",
HardResetAutostashPrompt: "Are you sure you want to hard reset to '%s'? An auto-stash will be performed if necessary.", OpenCommitInBrowser: "Open commit in browser",
CheckoutPrompt: "Are you sure you want to checkout '%s'?", ViewBisectOptions: "View bisect options",
UpstreamGone: "(upstream gone)", ConfirmRevertCommit: "Are you sure you want to revert {{.selectedCommit}}?",
NukeDescription: "If you want to make all the changes in the worktree go away, this is the way to do it. If there are dirty submodule changes this will stash those changes in the submodule(s).", RewordInEditorTitle: "Reword in editor",
DiscardStagedChangesDescription: "This will create a new stash entry containing only staged files and then drop it, so that the working tree is left with only unstaged changes", RewordInEditorPrompt: "Are you sure you want to reword this commit in your editor?",
EmptyOutput: "<Empty output>", HardResetAutostashPrompt: "Are you sure you want to hard reset to '%s'? An auto-stash will be performed if necessary.",
Patch: "Patch", CheckoutPrompt: "Are you sure you want to checkout '%s'?",
CustomPatch: "Custom patch", UpstreamGone: "(upstream gone)",
CommitsCopied: "commits copied", // lowercase because it's used in a sentence NukeDescription: "If you want to make all the changes in the worktree go away, this is the way to do it. If there are dirty submodule changes this will stash those changes in the submodule(s).",
CommitCopied: "commit copied", // lowercase because it's used in a sentence DiscardStagedChangesDescription: "This will create a new stash entry containing only staged files and then drop it, so that the working tree is left with only unstaged changes",
ResetPatch: "Reset patch", EmptyOutput: "<Empty output>",
ResetPatchTooltip: "Clear the current patch.", Patch: "Patch",
ApplyPatch: "Apply patch", CustomPatch: "Custom patch",
ApplyPatchTooltip: "Apply the current patch to the working tree.", CommitsCopied: "commits copied", // lowercase because it's used in a sentence
ApplyPatchInReverse: "Apply patch in reverse", CommitCopied: "commit copied", // lowercase because it's used in a sentence
ApplyPatchInReverseTooltip: "Apply the current patch in reverse to the working tree.", ResetPatch: "Reset patch",
RemovePatchFromOriginalCommit: "Remove patch from original commit (%s)", ResetPatchTooltip: "Clear the current patch.",
RemovePatchFromOriginalCommitTooltip: "Remove the current patch from its commit. This is achieved by starting an interactive rebase at the commit, applying the patch in reverse, and then continuing the rebase. If later commits depend on the patch, you may need to resolve conflicts.", ApplyPatch: "Apply patch",
MovePatchOutIntoIndex: "Move patch out into index", ApplyPatchTooltip: "Apply the current patch to the working tree.",
MovePatchOutIntoIndexTooltip: "Move the patch out of its commit and into the index. This is achieved by starting an interactive rebase at the commit, applying the patch in reverse, continuing the rebase to completion, and then applying the patch to the index. If later commits depend on the patch, you may need to resolve conflicts.", ApplyPatchInReverse: "Apply patch in reverse",
MovePatchIntoNewCommit: "Move patch into new commit", ApplyPatchInReverseTooltip: "Apply the current patch in reverse to the working tree.",
MovePatchIntoNewCommitTooltip: "Move the patch out of its commit and into a new commit sitting on top of the original commit. This is achieved by starting an interactive rebase at the original commit, applying the patch in reverse, then applying the patch to the index and committing it as a new commit, before continuing the rebase to completion. If later commits depend on the patch, you may need to resolve conflicts.", RemovePatchFromOriginalCommit: "Remove patch from original commit (%s)",
MovePatchToSelectedCommit: "Move patch to selected commit (%s)", RemovePatchFromOriginalCommitTooltip: "Remove the current patch from its commit. This is achieved by starting an interactive rebase at the commit, applying the patch in reverse, and then continuing the rebase. If later commits depend on the patch, you may need to resolve conflicts.",
MovePatchToSelectedCommitTooltip: "Move the patch out of its original commit and into the selected commit. This is achieved by starting an interactive rebase at the original commit, applying the patch in reverse, then continuing the rebase up to the selected commit, before applying the patch forward and amending the seleced commit. The rebase is then continued to completion. If commits between the source and destination commit depend on the patch, you may need to resolve conflicts.", MovePatchOutIntoIndex: "Move patch out into index",
CopyPatchToClipboard: "Copy patch to clipboard", MovePatchOutIntoIndexTooltip: "Move the patch out of its commit and into the index. This is achieved by starting an interactive rebase at the commit, applying the patch in reverse, continuing the rebase to completion, and then applying the patch to the index. If later commits depend on the patch, you may need to resolve conflicts.",
NoMatchesFor: "No matches for '%s' %s", MovePatchIntoNewCommit: "Move patch into new commit",
ExitSearchMode: "%s: Exit search mode", MovePatchIntoNewCommitTooltip: "Move the patch out of its commit and into a new commit sitting on top of the original commit. This is achieved by starting an interactive rebase at the original commit, applying the patch in reverse, then applying the patch to the index and committing it as a new commit, before continuing the rebase to completion. If later commits depend on the patch, you may need to resolve conflicts.",
ExitTextFilterMode: "%s: Exit filter mode", MovePatchToSelectedCommit: "Move patch to selected commit (%s)",
MatchesFor: "matches for '%s' (%d of %d) %s", // lowercase because it's after other text MovePatchToSelectedCommitTooltip: "Move the patch out of its original commit and into the selected commit. This is achieved by starting an interactive rebase at the original commit, applying the patch in reverse, then continuing the rebase up to the selected commit, before applying the patch forward and amending the seleced commit. The rebase is then continued to completion. If commits between the source and destination commit depend on the patch, you may need to resolve conflicts.",
SearchKeybindings: "%s: Next match, %s: Previous match, %s: Exit search mode", CopyPatchToClipboard: "Copy patch to clipboard",
SearchPrefix: "Search: ", NoMatchesFor: "No matches for '%s' %s",
FilterPrefix: "Filter: ", ExitSearchMode: "%s: Exit search mode",
WorktreesTitle: "Worktrees", ExitTextFilterMode: "%s: Exit filter mode",
WorktreeTitle: "Worktree", MatchesFor: "matches for '%s' (%d of %d) %s", // lowercase because it's after other text
Switch: "Switch", SearchKeybindings: "%s: Next match, %s: Previous match, %s: Exit search mode",
SwitchToWorktree: "Switch to worktree", SearchPrefix: "Search: ",
SwitchToWorktreeTooltip: "Switch to the selected worktree.", FilterPrefix: "Filter: ",
AlreadyCheckedOutByWorktree: "This branch is checked out by worktree {{.worktreeName}}. Do you want to switch to that worktree?", WorktreesTitle: "Worktrees",
BranchCheckedOutByWorktree: "Branch {{.branchName}} is checked out by worktree {{.worktreeName}}", WorktreeTitle: "Worktree",
DetachWorktreeTooltip: "This will run `git checkout --detach` on the worktree so that it stops hogging the branch, but the worktree's working tree will be left alone.", Switch: "Switch",
Switching: "Switching", SwitchToWorktree: "Switch to worktree",
RemoveWorktree: "Remove worktree", SwitchToWorktreeTooltip: "Switch to the selected worktree.",
RemoveWorktreeTitle: "Remove worktree", AlreadyCheckedOutByWorktree: "This branch is checked out by worktree {{.worktreeName}}. Do you want to switch to that worktree?",
RemoveWorktreePrompt: "Are you sure you want to remove worktree '{{.worktreeName}}'?", BranchCheckedOutByWorktree: "Branch {{.branchName}} is checked out by worktree {{.worktreeName}}",
ForceRemoveWorktreePrompt: "'{{.worktreeName}}' contains modified or untracked files (to be honest, it could contain both). Are you sure you want to remove it?", DetachWorktreeTooltip: "This will run `git checkout --detach` on the worktree so that it stops hogging the branch, but the worktree's working tree will be left alone.",
RemovingWorktree: "Deleting worktree", Switching: "Switching",
DetachWorktree: "Detach worktree", RemoveWorktree: "Remove worktree",
DetachingWorktree: "Detaching worktree", RemoveWorktreeTitle: "Remove worktree",
AddingWorktree: "Adding worktree", RemoveWorktreePrompt: "Are you sure you want to remove worktree '{{.worktreeName}}'?",
CantDeleteCurrentWorktree: "You cannot remove the current worktree!", ForceRemoveWorktreePrompt: "'{{.worktreeName}}' contains modified or untracked files (to be honest, it could contain both). Are you sure you want to remove it?",
AlreadyInWorktree: "You are already in the selected worktree", RemovingWorktree: "Deleting worktree",
CantDeleteMainWorktree: "You cannot remove the main worktree!", DetachWorktree: "Detach worktree",
NoWorktreesThisRepo: "No worktrees", DetachingWorktree: "Detaching worktree",
MissingWorktree: "(missing)", AddingWorktree: "Adding worktree",
MainWorktree: "(main)", CantDeleteCurrentWorktree: "You cannot remove the current worktree!",
NewWorktree: "New worktree", AlreadyInWorktree: "You are already in the selected worktree",
NewWorktreePath: "New worktree path", CantDeleteMainWorktree: "You cannot remove the main worktree!",
NewWorktreeBase: "New worktree base ref", NoWorktreesThisRepo: "No worktrees",
RemoveWorktreeTooltip: "Remove the selected worktree. This will both delete the worktree's directory, as well as metadata about the worktree in the .git directory.", MissingWorktree: "(missing)",
BranchNameCannotBeBlank: "Branch name cannot be blank", MainWorktree: "(main)",
NewBranchName: "New branch name", NewWorktree: "New worktree",
NewBranchNameLeaveBlank: "New branch name (leave blank to checkout {{.default}})", NewWorktreePath: "New worktree path",
ViewWorktreeOptions: "View worktree options", NewWorktreeBase: "New worktree base ref",
CreateWorktreeFrom: "Create worktree from {{.ref}}", RemoveWorktreeTooltip: "Remove the selected worktree. This will both delete the worktree's directory, as well as metadata about the worktree in the .git directory.",
CreateWorktreeFromDetached: "Create worktree from {{.ref}} (detached)", BranchNameCannotBeBlank: "Branch name cannot be blank",
LcWorktree: "worktree", NewBranchName: "New branch name",
ChangingDirectoryTo: "Changing directory to {{.path}}", NewBranchNameLeaveBlank: "New branch name (leave blank to checkout {{.default}})",
Name: "Name", ViewWorktreeOptions: "View worktree options",
Branch: "Branch", CreateWorktreeFrom: "Create worktree from {{.ref}}",
Path: "Path", CreateWorktreeFromDetached: "Create worktree from {{.ref}} (detached)",
MarkedBaseCommitStatus: "Marked a base commit for rebase", LcWorktree: "worktree",
MarkAsBaseCommit: "Mark as base commit for rebase", ChangingDirectoryTo: "Changing directory to {{.path}}",
MarkAsBaseCommitTooltip: "Select a base commit for the next rebase. When you rebase onto a branch, only commits above the base commit will be brought across. This uses the `git rebase --onto` command.", Name: "Name",
MarkedCommitMarker: "↑↑↑ Will rebase from here ↑↑↑", Branch: "Branch",
PleaseGoToURL: "Please go to {{.url}}", Path: "Path",
DisabledMenuItemPrefix: "Disabled: ", MarkedBaseCommitStatus: "Marked a base commit for rebase",
NoCopiedCommits: "No copied commits", MarkAsBaseCommit: "Mark as base commit for rebase",
QuickStartInteractiveRebase: "Start interactive rebase", MarkAsBaseCommitTooltip: "Select a base commit for the next rebase. When you rebase onto a branch, only commits above the base commit will be brought across. This uses the `git rebase --onto` command.",
QuickStartInteractiveRebaseTooltip: "Start an interactive rebase for the commits on your branch. This will include all commits from the HEAD commit down to the first merge commit or main branch commit.\nIf you would instead like to start an interactive rebase from the selected commit, press `{{.editKey}}`.", MarkedCommitMarker: "↑↑↑ Will rebase from here ↑↑↑",
CannotQuickStartInteractiveRebase: "Cannot start interactive rebase: the HEAD commit is a merge commit or is present on the main branch, so there is no appropriate base commit to start the rebase from. You can start an interactive rebase from a specific commit by selecting the commit and pressing `{{.editKey}}`.", PleaseGoToURL: "Please go to {{.url}}",
RangeSelectUp: "Range select up", DisabledMenuItemPrefix: "Disabled: ",
RangeSelectDown: "Range select down", NoCopiedCommits: "No copied commits",
RangeSelectNotSupported: "Action does not support range selection, please select a single item", QuickStartInteractiveRebase: "Start interactive rebase",
NoItemSelected: "No item selected", QuickStartInteractiveRebaseTooltip: "Start an interactive rebase for the commits on your branch. This will include all commits from the HEAD commit down to the first merge commit or main branch commit.\nIf you would instead like to start an interactive rebase from the selected commit, press `{{.editKey}}`.",
SelectedItemIsNotABranch: "Selected item is not a branch", CannotQuickStartInteractiveRebase: "Cannot start interactive rebase: the HEAD commit is a merge commit or is present on the main branch, so there is no appropriate base commit to start the rebase from. You can start an interactive rebase from a specific commit by selecting the commit and pressing `{{.editKey}}`.",
SelectedItemDoesNotHaveFiles: "Selected item does not have files to view", RangeSelectUp: "Range select up",
RangeSelectNotSupportedForSubmodules: "Range select not supported for submodules", RangeSelectDown: "Range select down",
OldCherryPickKeyWarning: "The 'c' key is no longer the default key for copying commits to cherry pick. Please use `{{.copy}}` instead (and `{{.paste}}` to paste). The reason for this change is that the 'v' key for selecting a range of lines when staging is now also used for selecting a range of lines in any list view, meaning that we needed to find a new key for pasting commits, and if we're going to now use `{{.paste}}` for pasting commits, we may as well use `{{.copy}}` for copying them. If you want to configure the keybindings to get the old behaviour, set the following in your config:\n\nkeybinding:\n universal:\n toggleRangeSelect: <something other than v>\n commits:\n cherryPickCopy: 'c'\n pasteCommits: 'v'", RangeSelectNotSupported: "Action does not support range selection, please select a single item",
CommandDoesNotSupportOpeningInEditor: "This command doesn't support switching to the editor", NoItemSelected: "No item selected",
SelectedItemIsNotABranch: "Selected item is not a branch",
SelectedItemDoesNotHaveFiles: "Selected item does not have files to view",
RangeSelectNotSupportedForSubmodules: "Range select not supported for submodules",
OldCherryPickKeyWarning: "The 'c' key is no longer the default key for copying commits to cherry pick. Please use `{{.copy}}` instead (and `{{.paste}}` to paste). The reason for this change is that the 'v' key for selecting a range of lines when staging is now also used for selecting a range of lines in any list view, meaning that we needed to find a new key for pasting commits, and if we're going to now use `{{.paste}}` for pasting commits, we may as well use `{{.copy}}` for copying them. If you want to configure the keybindings to get the old behaviour, set the following in your config:\n\nkeybinding:\n universal:\n toggleRangeSelect: <something other than v>\n commits:\n cherryPickCopy: 'c'\n pasteCommits: 'v'",
CommandDoesNotSupportOpeningInEditor: "This command doesn't support switching to the editor",
Actions: Actions{ Actions: Actions{
// TODO: combine this with the original keybinding descriptions (those are all in lowercase atm) // TODO: combine this with the original keybinding descriptions (those are all in lowercase atm)

View file

@ -0,0 +1,41 @@
package diff
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var RenameSimilarityThresholdChange = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Change the rename similarity threshold while in the commits panel",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("original", "one\ntwo\nthree\nfour\nfive\n")
shell.Commit("add original")
shell.DeleteFileAndAdd("original")
shell.CreateFileAndAdd("renamed", "one\ntwo\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten\n")
shell.Commit("change name and contents")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().Focus()
t.Views().Main().
ContainsLines(
Contains("2 files changed, 10 insertions(+), 5 deletions(-)"),
)
t.Views().Commits().
Press(keys.Universal.DecreaseRenameSimilarityThreshold).
Tap(func() {
t.ExpectToast(Equals("Changed rename similarity threshold to 45%"))
})
t.Views().Main().
ContainsLines(
Contains("original => renamed"),
Contains("1 file changed, 5 insertions(+)"),
)
},
})

View file

@ -0,0 +1,35 @@
package file
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var RenameSimilarityThresholdChange = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Change the rename similarity threshold while in the files panel",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("original", "one\ntwo\nthree\nfour\nfive\n")
shell.Commit("add original")
shell.DeleteFileAndAdd("original")
shell.CreateFileAndAdd("renamed", "one\ntwo\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten\n")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Contains("D ").Contains("original"),
Contains("A ").Contains("renamed"),
).
Press(keys.Universal.DecreaseRenameSimilarityThreshold).
Tap(func() {
t.ExpectToast(Equals("Changed rename similarity threshold to 45%"))
}).
Lines(
Contains("R ").Contains("original → renamed"),
)
},
})

View file

@ -149,6 +149,7 @@ var tests = []*components.IntegrationTest{
diff.DiffAndApplyPatch, diff.DiffAndApplyPatch,
diff.DiffCommits, diff.DiffCommits,
diff.IgnoreWhitespace, diff.IgnoreWhitespace,
diff.RenameSimilarityThresholdChange,
file.CopyMenu, file.CopyMenu,
file.DirWithUntrackedFile, file.DirWithUntrackedFile,
file.DiscardAllDirChanges, file.DiscardAllDirChanges,
@ -161,6 +162,7 @@ var tests = []*components.IntegrationTest{
file.DiscardVariousChangesRangeSelect, file.DiscardVariousChangesRangeSelect,
file.Gitignore, file.Gitignore,
file.RememberCommitMessageAfterFail, file.RememberCommitMessageAfterFail,
file.RenameSimilarityThresholdChange,
file.StageChildrenRangeSelect, file.StageChildrenRangeSelect,
file.StageRangeSelect, file.StageRangeSelect,
filter_and_search.FilterCommitFiles, filter_and_search.FilterCommitFiles,

View file

@ -1322,6 +1322,14 @@
"type": "string", "type": "string",
"default": "{" "default": "{"
}, },
"increaseRenameSimilarityThreshold": {
"type": "string",
"default": ")"
},
"decreaseRenameSimilarityThreshold": {
"type": "string",
"default": "("
},
"openDiffTool": { "openDiffTool": {
"type": "string", "type": "string",
"default": "\u003cc-t\u003e" "default": "\u003cc-t\u003e"