Compare commits

..
Author SHA1 Message Date
Stefan Haller 781eb61ed2 Add a "Show full diff" checkbox to the filtering menu
It is only visible when filtering by path.
2025-05-25 15:22:34 +02:00
Stefan Haller b5d97570f1 Add key bindings to filtering menu 2025-05-25 15:08:15 +02:00
Jesse Duffield da32b59e11 Fix lazygit's UI becoming unresponsive when a background fetch asks for a passphrase (#4586)
Fix a regression introduced with #4525.

This fixes the problem that background fetching makes lazygit hang when
the fetch request needs to prompt for a passphrase. For Mac users who
use the keychain to store their ssh passphrases, this can happen when
lazygit is running while the machine goes to sleep, because macOS looks
the keychain in that case.
2025-05-23 20:33:22 +10:00
Stefan Haller 2a8ef71e8f Use PTY also with credentialStrategy=FAIL
This is a regression introduced with a199ed1396c; it is important to use a PTY
even with credentialStrategy=FAIL, otherwise the fetch command will spew the
credentials request into the UI and then hang.

This fixes the problem that background fetching makes lazygit hang when the
fetch request needs to prompt for a passphrase. For Mac users who use the
keychain to store their ssh passphrases, this can happen when lazygit is running
while the machine goes to sleep, because macOS looks the keychain in that case.
2025-05-23 11:34:57 +02:00
5 changed files with 21 additions and 2 deletions
+1 -1
View File
@@ -271,7 +271,7 @@ func (self *CommitCommands) ShowCmdObj(hash string, filterPath string) *oscomman
Arg(hash).
ArgIf(self.AppState.IgnoreWhitespaceInDiffView, "--ignore-all-space").
Arg(fmt.Sprintf("--find-renames=%d%%", self.AppState.RenameSimilarityThreshold)).
ArgIf(filterPath != "", "--", filterPath).
ArgIf(filterPath != "" && !self.AppState.ShowFullDiffInFilterByPathMode, "--", filterPath).
Dir(self.repoPaths.worktreePath).
ToArgv()
+1
View File
@@ -196,6 +196,7 @@ func (self *CmdObj) PromptOnCredentialRequest(task gocui.Task) *CmdObj {
func (self *CmdObj) FailOnCredentialRequest() *CmdObj {
self.credentialStrategy = FAIL
self.usePty = true
return self
}
+2
View File
@@ -691,6 +691,8 @@ type AppState struct {
// This determines whether the git graph is rendered in the commits panel
// One of 'always' | 'never' | 'when-maximised'
GitLogShowGraph string
ShowFullDiffInFilterByPathMode bool
}
func getDefaultAppState() *AppState {
@@ -60,6 +60,7 @@ func (self *FilteringMenuAction) Call() error {
menuItems = append(menuItems, &types.MenuItem{
Label: self.c.Tr.FilterPathOption,
Key: 'p',
OnPress: func() error {
self.c.Prompt(types.PromptOpts{
FindSuggestionsFunc: self.c.Helpers().Suggestions.GetFilePathSuggestionsFunc(),
@@ -76,6 +77,7 @@ func (self *FilteringMenuAction) Call() error {
menuItems = append(menuItems, &types.MenuItem{
Label: self.c.Tr.FilterAuthorOption,
Key: 'a',
OnPress: func() error {
self.c.Prompt(types.PromptOpts{
FindSuggestionsFunc: self.c.Helpers().Suggestions.GetAuthorsSuggestionsFunc(),
@@ -90,9 +92,23 @@ func (self *FilteringMenuAction) Call() error {
Tooltip: tooltip,
})
if path := self.c.Modes().Filtering.GetPath(); path != "" {
menuItems = append(menuItems, &types.MenuItem{
Label: "Show full diff", // TODO: i18n (and tooltip?)
Key: 'f',
OnPress: func() error {
self.c.AppState.ShowFullDiffInFilterByPathMode = !self.c.AppState.ShowFullDiffInFilterByPathMode
self.c.SaveAppStateAndLogError()
return self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.COMMITS}})
},
Widget: types.MakeMenuCheckBox(self.c.AppState.ShowFullDiffInFilterByPathMode),
})
}
if self.c.Modes().Filtering.Active() {
menuItems = append(menuItems, &types.MenuItem{
Label: self.c.Tr.ExitFilterMode,
Key: 's',
OnPress: self.c.Helpers().Mode.ClearFiltering,
})
}
+1 -1
View File
@@ -57,7 +57,7 @@ func (self *DiffHelper) GetUpdateTaskForRenderingCommitsDiff(commit *models.Comm
from, to := refRange.From, refRange.To
args := []string{from.ParentRefName(), to.RefName(), "--stat", "-p"}
args = append(args, "--")
if path := self.c.Modes().Filtering.GetPath(); path != "" {
if path := self.c.Modes().Filtering.GetPath(); path != "" && !self.c.AppState.ShowFullDiffInFilterByPathMode {
args = append(args, path)
}
cmdObj := self.c.Git().Diff.DiffCmdObj(args)