From 1ba4f83471c57f1c563dc83e4dd50bd0b2defbf7 Mon Sep 17 00:00:00 2001 From: michaelhass Date: Tue, 14 Oct 2025 08:39:06 +0200 Subject: [PATCH 1/7] rename commit content --- internal/ui/commit/content.go | 37 ----------------------------------- internal/ui/commit/dialog.go | 37 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 37 deletions(-) delete mode 100644 internal/ui/commit/content.go create mode 100644 internal/ui/commit/dialog.go diff --git a/internal/ui/commit/content.go b/internal/ui/commit/content.go deleted file mode 100644 index c6a665f..0000000 --- a/internal/ui/commit/content.go +++ /dev/null @@ -1,37 +0,0 @@ -package commit - -import ( - tea "github.com/charmbracelet/bubbletea" - "github.com/michaelhass/gitglance/internal/ui/dialog" -) - -// Content is a wrapper to use the commit ui as dialog.Content. -type Content struct { - Model -} - -func NewContent(commit Model) Content { - return Content{ - Model: commit, - } -} - -func (c Content) Init() tea.Cmd { - return c.Model.Init() -} - -func (c Content) Update(msg tea.Msg) (dialog.Content, tea.Cmd) { - model, cmd := c.Model.Update(msg) - c.Model = model - - return c, cmd -} - -func (c Content) View() string { - return c.Model.View() -} - -func (c Content) SetSize(width, height int) dialog.Content { - c.Model = c.Model.SetSize(width, height) - return c -} diff --git a/internal/ui/commit/dialog.go b/internal/ui/commit/dialog.go new file mode 100644 index 0000000..ff34f2e --- /dev/null +++ b/internal/ui/commit/dialog.go @@ -0,0 +1,37 @@ +package commit + +import ( + tea "github.com/charmbracelet/bubbletea" + "github.com/michaelhass/gitglance/internal/ui/dialog" +) + +// DialogContent is a wrapper to use the commit ui as dialog.DialogContent. +type DialogContent struct { + Model +} + +func NewContent(commit Model) DialogContent { + return DialogContent{ + Model: commit, + } +} + +func (dc DialogContent) Init() tea.Cmd { + return dc.Model.Init() +} + +func (dc DialogContent) Update(msg tea.Msg) (dialog.Content, tea.Cmd) { + model, cmd := dc.Model.Update(msg) + dc.Model = model + + return dc, cmd +} + +func (dc DialogContent) View() string { + return dc.Model.View() +} + +func (dc DialogContent) SetSize(width, height int) dialog.Content { + dc.Model = dc.Model.SetSize(width, height) + return dc +} From 9a30f2d9c5d386b0b81953ed0da53bcc34d69c51 Mon Sep 17 00:00:00 2001 From: michaelhass Date: Tue, 14 Oct 2025 08:49:36 +0200 Subject: [PATCH 2/7] split and rename confirm models --- internal/ui/confirm/confirm.go | 4 ++-- internal/ui/confirm/dialog.go | 33 +++++++++++++++++++++++++++++++++ internal/ui/status/cmd.go | 16 ++++++++-------- 3 files changed, 43 insertions(+), 10 deletions(-) create mode 100644 internal/ui/confirm/dialog.go diff --git a/internal/ui/confirm/confirm.go b/internal/ui/confirm/confirm.go index 872ee19..4da683e 100644 --- a/internal/ui/confirm/confirm.go +++ b/internal/ui/confirm/confirm.go @@ -43,7 +43,7 @@ func (m Model) Init() tea.Cmd { return nil } -func (m Model) Update(msg tea.Msg) (dialog.Content, tea.Cmd) { +func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { if keyMsg, ok := msg.(tea.KeyMsg); ok && key.Matches(keyMsg, m.keys.confirm) { return m, tea.Sequence(m.confirmCmd, dialog.Close()) } @@ -67,7 +67,7 @@ func (m Model) Help() []key.Binding { } } -func (m Model) SetSize(width, height int) dialog.Content { +func (m Model) SetSize(width, height int) Model { m.width = width m.height = height return m diff --git a/internal/ui/confirm/dialog.go b/internal/ui/confirm/dialog.go new file mode 100644 index 0000000..b78cb37 --- /dev/null +++ b/internal/ui/confirm/dialog.go @@ -0,0 +1,33 @@ +package confirm + +import ( + tea "github.com/charmbracelet/bubbletea" + "github.com/michaelhass/gitglance/internal/ui/dialog" +) + +type DialogContent struct { + Model +} + +func NewDialogConent(confirm Model) DialogContent { + return DialogContent{Model: confirm} +} + +func (dc DialogContent) Init() tea.Cmd { + return dc.Model.Init() +} + +func (dc DialogContent) Update(msg tea.Msg) (dialog.Content, tea.Cmd) { + model, cmd := dc.Model.Update(msg) + dc.Model = model + return dc, cmd +} + +func (dc DialogContent) View() string { + return dc.Model.View() +} + +func (dc DialogContent) SetSize(width, height int) dialog.Content { + dc.Model = dc.Model.SetSize(width, height) + return dc +} diff --git a/internal/ui/status/cmd.go b/internal/ui/status/cmd.go index d978090..378af08 100644 --- a/internal/ui/status/cmd.go +++ b/internal/ui/status/cmd.go @@ -128,12 +128,7 @@ func deleteFile(fileItem filelist.Item) tea.Cmd { }), list.ForceFocusUpdate, ) - confirmDialog := confirm.New( - title, - msg, - confirmCmd, - ) - + confirmDialog := confirm.NewDialogConent(confirm.New(title, msg, confirmCmd)) return dialog.Show(confirmDialog, nil, dialog.CenterDisplayMode) } @@ -210,8 +205,13 @@ func showCommitDialog(branchName string, files git.FileStatusList) tea.Cmd { } func showStashAllConfirmation() tea.Cmd { - confirm := confirm.New("Stash", "Do you want to stash all changes?", stashAll()) - return dialog.Show(confirm, refreshStatus(), dialog.CenterDisplayMode) + confirmDialog := confirm.NewDialogConent( + confirm.New( + "Stash", "Do you want to stash all changes?", + stashAll(), + ), + ) + return dialog.Show(confirmDialog, refreshStatus(), dialog.CenterDisplayMode) } type stashedMsg struct { From c6b80629f11ab5853038752f223ab81ab435a64e Mon Sep 17 00:00:00 2001 From: michaelhass Date: Tue, 14 Oct 2025 08:52:05 +0200 Subject: [PATCH 3/7] Rename diff container content --- internal/ui/diff/container.go | 32 ++++++++++++++++++++++++++++++++ internal/ui/diff/content.go | 32 -------------------------------- internal/ui/status/status.go | 2 +- 3 files changed, 33 insertions(+), 33 deletions(-) create mode 100644 internal/ui/diff/container.go delete mode 100644 internal/ui/diff/content.go diff --git a/internal/ui/diff/container.go b/internal/ui/diff/container.go new file mode 100644 index 0000000..2e911f6 --- /dev/null +++ b/internal/ui/diff/container.go @@ -0,0 +1,32 @@ +package diff + +import ( + tea "github.com/charmbracelet/bubbletea" + "github.com/michaelhass/gitglance/internal/ui/container" +) + +// ContainerContent is a wrapper to use the commit ui as container.ContainerContent. +type ContainerContent struct { + Model +} + +func NewContent(model Model) ContainerContent { + return ContainerContent{Model: model} +} + +func (c ContainerContent) Update(msg tea.Msg) (container.Content, tea.Cmd) { + model, cmd := c.Model.Update(msg) + c.Model = model + return c, cmd +} + +func (c ContainerContent) UpdateFocus(isFocused bool) (container.Content, tea.Cmd) { + model, cmd := c.Model.UpdateFocus(isFocused) + c.Model = model + return c, cmd +} + +func (c ContainerContent) SetSize(width, height int) container.Content { + c.Model = c.Model.SetSize(width, height) + return c +} diff --git a/internal/ui/diff/content.go b/internal/ui/diff/content.go deleted file mode 100644 index 41fd5f0..0000000 --- a/internal/ui/diff/content.go +++ /dev/null @@ -1,32 +0,0 @@ -package diff - -import ( - tea "github.com/charmbracelet/bubbletea" - "github.com/michaelhass/gitglance/internal/ui/container" -) - -// Content is a wrapper to use the commit ui as container.Content. -type Content struct { - Model -} - -func NewContent(model Model) Content { - return Content{Model: model} -} - -func (c Content) Update(msg tea.Msg) (container.Content, tea.Cmd) { - model, cmd := c.Model.Update(msg) - c.Model = model - return c, cmd -} - -func (c Content) UpdateFocus(isFocused bool) (container.Content, tea.Cmd) { - model, cmd := c.Model.UpdateFocus(isFocused) - c.Model = model - return c, cmd -} - -func (c Content) SetSize(width, height int) container.Content { - c.Model = c.Model.SetSize(width, height) - return c -} diff --git a/internal/ui/status/status.go b/internal/ui/status/status.go index 8fc30f1..fb546ff 100644 --- a/internal/ui/status/status.go +++ b/internal/ui/status/status.go @@ -304,7 +304,7 @@ func (m Model) handleStatusUpdateMsg(msg statusUpdateMsg) (Model, tea.Cmd) { } func (m Model) handleLoadedDiffMsg(msg loadedDiffMsg) (Model, tea.Cmd) { - section, ok := m.sections[diffSection].Content().(diff.Content) + section, ok := m.sections[diffSection].Content().(diff.ContainerContent) if !ok { return m, nil } From 5853abec1b13576839fb30f877d76c1cecdd13dd Mon Sep 17 00:00:00 2001 From: michaelhass Date: Tue, 14 Oct 2025 08:56:38 +0200 Subject: [PATCH 4/7] rename list container content --- internal/ui/list/container.go | 32 ++++++++++++++++++++++++++++++++ internal/ui/list/content.go | 32 -------------------------------- internal/ui/status/status.go | 4 ++-- 3 files changed, 34 insertions(+), 34 deletions(-) create mode 100644 internal/ui/list/container.go delete mode 100644 internal/ui/list/content.go diff --git a/internal/ui/list/container.go b/internal/ui/list/container.go new file mode 100644 index 0000000..a46235f --- /dev/null +++ b/internal/ui/list/container.go @@ -0,0 +1,32 @@ +package list + +import ( + tea "github.com/charmbracelet/bubbletea" + "github.com/michaelhass/gitglance/internal/ui/container" +) + +// ContainerContent is a wrapper to use the filelist ui as container.ContainerContent. +type ContainerContent struct { + Model +} + +func NewContent(model Model) ContainerContent { + return ContainerContent{Model: model} +} + +func (c ContainerContent) Update(msg tea.Msg) (container.Content, tea.Cmd) { + model, cmd := c.Model.Update(msg) + c.Model = model + return c, cmd +} + +func (c ContainerContent) UpdateFocus(isFocused bool) (container.Content, tea.Cmd) { + model, cmd := c.Model.UpdateFocus(isFocused) + c.Model = model + return c, cmd +} + +func (c ContainerContent) SetSize(width, height int) container.Content { + c.Model = c.Model.SetSize(width, height) + return c +} diff --git a/internal/ui/list/content.go b/internal/ui/list/content.go deleted file mode 100644 index 77ec468..0000000 --- a/internal/ui/list/content.go +++ /dev/null @@ -1,32 +0,0 @@ -package list - -import ( - tea "github.com/charmbracelet/bubbletea" - "github.com/michaelhass/gitglance/internal/ui/container" -) - -// Content is a wrapper to use the filelist ui as container.Content. -type Content struct { - Model -} - -func NewContent(model Model) Content { - return Content{Model: model} -} - -func (c Content) Update(msg tea.Msg) (container.Content, tea.Cmd) { - model, cmd := c.Model.Update(msg) - c.Model = model - return c, cmd -} - -func (c Content) UpdateFocus(isFocused bool) (container.Content, tea.Cmd) { - model, cmd := c.Model.UpdateFocus(isFocused) - c.Model = model - return c, cmd -} - -func (c Content) SetSize(width, height int) container.Content { - c.Model = c.Model.SetSize(width, height) - return c -} diff --git a/internal/ui/status/status.go b/internal/ui/status/status.go index fb546ff..f46240b 100644 --- a/internal/ui/status/status.go +++ b/internal/ui/status/status.go @@ -284,13 +284,13 @@ func (m Model) handleStatusUpdateMsg(msg statusUpdateMsg) (Model, tea.Cmd) { return m, exit.WithMsg(msg.Err.Error()) } - if section, ok := m.sections[unstagedSection].Content().(list.Content); ok { + if section, ok := m.sections[unstagedSection].Content().(list.ContainerContent); ok { model, cmd := section.SetItems(createListItems(m.workTreeStatus.UnstagedFiles(), false)) section.Model = model cmds = append(cmds, cmd) m.sections[unstagedSection] = m.sections[unstagedSection].SetContent(section) } - if section, ok := m.sections[stagedSection].Content().(list.Content); ok { + if section, ok := m.sections[stagedSection].Content().(list.ContainerContent); ok { model, cmd := section.SetItems(createListItems(m.workTreeStatus.StagedFiles(), true)) model = model.SetTitle(fmt.Sprintf("Staged [%s]", m.workTreeStatus.CleanedBranchName)) section.Model = model From 8c87a261bb4332427db1800778bce9afdff66560 Mon Sep 17 00:00:00 2001 From: michaelhass Date: Tue, 14 Oct 2025 09:24:35 +0200 Subject: [PATCH 5/7] split text input models --- internal/ui/commit/commit.go | 15 ++-- internal/ui/list/container.go | 7 +- internal/ui/status/status.go | 4 +- internal/ui/textinput/container.go | 36 +++++++++ .../ui/textinput/{content.go => textinput.go} | 73 +++++++++---------- 5 files changed, 88 insertions(+), 47 deletions(-) create mode 100644 internal/ui/textinput/container.go rename internal/ui/textinput/{content.go => textinput.go} (55%) diff --git a/internal/ui/commit/commit.go b/internal/ui/commit/commit.go index c18f992..d69b912 100644 --- a/internal/ui/commit/commit.go +++ b/internal/ui/commit/commit.go @@ -24,7 +24,7 @@ type Model struct { } func New(branch string, stagedFileList git.FileStatusList) Model { - fileListContent := list.NewContent( + fileListContent := list.NewContainerContent( list.New( "Staged", func(msg tea.Msg) tea.Cmd { return nil }, @@ -42,8 +42,8 @@ func New(branch string, stagedFileList git.FileStatusList) Model { fileListContent.Model, _ = fileListContent.SetItems(createListItems(stagedFileList)) - messageContainer := container.New( - textinput.NewContent( + messageContainer := textinput.NewContainer( + textinput.New( fmt.Sprintf("%s [%s]", "Commit", branch), "Enter commit message", ), @@ -77,7 +77,7 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { m, cmd = m.toggleFocus() cmds = append(cmds, cmd) case key.Matches(msg, m.keys.commit): - if mc, ok := m.message.Content().(textinput.Content); ok { + if mc, ok := m.message.Content().(textinput.ContainerContent); ok { return m, tea.Sequence(Execute(mc.Text()), dialog.Close()) } } @@ -114,9 +114,10 @@ func (m Model) Help() []key.Binding { } func (m Model) setMsg(msg string) (Model, tea.Cmd) { - if input, ok := m.message.Content().(textinput.Content); ok { - input = input.SetValue(msg) - input = input.SetCursorToStart() + if input, ok := m.message.Content().(textinput.ContainerContent); ok { + input.Model = input.Model. + SetValue(msg). + SetCursorToStart() m.message = m.message.SetContent(input) } return m, nil diff --git a/internal/ui/list/container.go b/internal/ui/list/container.go index a46235f..9000709 100644 --- a/internal/ui/list/container.go +++ b/internal/ui/list/container.go @@ -10,10 +10,15 @@ type ContainerContent struct { Model } -func NewContent(model Model) ContainerContent { +func NewContainerContent(model Model) ContainerContent { return ContainerContent{Model: model} } +func NewContainer(model Model) container.Model { + containerContent := NewContainerContent(model) + return container.New(containerContent) +} + func (c ContainerContent) Update(msg tea.Msg) (container.Content, tea.Cmd) { model, cmd := c.Model.Update(msg) c.Model = model diff --git a/internal/ui/status/status.go b/internal/ui/status/status.go index f46240b..e3beb65 100644 --- a/internal/ui/status/status.go +++ b/internal/ui/status/status.go @@ -125,7 +125,7 @@ func New() Model { help := help.New() help.ShowAll = false - unstagedFileList := list.NewContent( + unstagedFileList := list.NewContainerContent( list.New("Unstaged", unstagedFilesItemHandler, list.NewKeyMap( "stage all", "stage file", @@ -139,7 +139,7 @@ func New() Model { ) stagedFileListKeyMap.Delete.SetEnabled(false) - stagedFileList := list.NewContent(list.New("Staged", stagedFilesItemHandler, stagedFileListKeyMap)) + stagedFileList := list.NewContainerContent(list.New("Staged", stagedFilesItemHandler, stagedFileListKeyMap)) diffContent := diff.NewContent(diff.New()) return Model{ diff --git a/internal/ui/textinput/container.go b/internal/ui/textinput/container.go new file mode 100644 index 0000000..8838bb7 --- /dev/null +++ b/internal/ui/textinput/container.go @@ -0,0 +1,36 @@ +package textinput + +import ( + tea "github.com/charmbracelet/bubbletea" + "github.com/michaelhass/gitglance/internal/ui/container" +) + +type ContainerContent struct { + Model +} + +func NewContainerContent(model Model) ContainerContent { + return ContainerContent{Model: model} +} + +func NewContainer(model Model) container.Model { + containerContent := NewContainerContent(model) + return container.New(containerContent) +} + +func (c ContainerContent) Update(msg tea.Msg) (container.Content, tea.Cmd) { + model, cmd := c.Model.Update(msg) + c.Model = model + return c, cmd +} + +func (c ContainerContent) UpdateFocus(isFocused bool) (container.Content, tea.Cmd) { + model, cmd := c.Model.UpdateFocus(isFocused) + c.Model = model + return c, cmd +} + +func (c ContainerContent) SetSize(width, height int) container.Content { + c.Model = c.Model.SetSize(width, height) + return c +} diff --git a/internal/ui/textinput/content.go b/internal/ui/textinput/textinput.go similarity index 55% rename from internal/ui/textinput/content.go rename to internal/ui/textinput/textinput.go index 4771505..3ef0ea8 100644 --- a/internal/ui/textinput/content.go +++ b/internal/ui/textinput/textinput.go @@ -7,7 +7,6 @@ import ( "github.com/charmbracelet/bubbles/textarea" tea "github.com/charmbracelet/bubbletea" "github.com/charmbracelet/lipgloss" - "github.com/michaelhass/gitglance/internal/ui/container" "github.com/michaelhass/gitglance/internal/ui/style" ) @@ -15,7 +14,7 @@ var ( countStyle = style.SublteText.Height(1) ) -type Content struct { +type Model struct { title string textarea textarea.Model @@ -26,7 +25,7 @@ type Content struct { isFocused bool } -func NewContent(title string, placeholder string) Content { +func New(title string, placeholder string) Model { var ( textarea = textarea.New() blurredStyle = textarea.BlurredStyle @@ -47,84 +46,84 @@ func NewContent(title string, placeholder string) Content { focusedStyle.CursorLine = lipgloss.NewStyle() textarea.FocusedStyle = focusedStyle - return Content{ + return Model{ title: title, textarea: textarea, } } -func (c Content) Init() tea.Cmd { +func (m Model) Init() tea.Cmd { return nil } -func (c Content) Update(msg tea.Msg) (container.Content, tea.Cmd) { - textarea, cmd := c.textarea.Update(msg) - c.textarea = textarea - return c, cmd +func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { + textarea, cmd := m.textarea.Update(msg) + m.textarea = textarea + return m, cmd } -func (c Content) UpdateFocus(isFocused bool) (container.Content, tea.Cmd) { - c.isFocused = isFocused +func (m Model) UpdateFocus(isFocused bool) (Model, tea.Cmd) { + m.isFocused = isFocused if isFocused { - c.textarea.Focus() + m.textarea.Focus() } else { - c.textarea.Blur() + m.textarea.Blur() } - return c, nil + return m, nil } -func (c Content) View() string { - inputLength := len([]rune(c.textarea.Value())) +func (m Model) View() string { + inputLength := len([]rune(m.textarea.Value())) count := countStyle. - MaxWidth(c.width - 2). + MaxWidth(m.width - 2). Render(fmt.Sprint("Chararcters ", inputLength)) countLine := lipgloss.PlaceHorizontal( - c.width-2, + m.width-2, lipgloss.Right, count, ) return lipgloss.JoinVertical( lipgloss.Top, - c.textarea.View(), + m.textarea.View(), countLine, ) } -func (c Content) Title() string { - return c.title +func (m Model) Title() string { + return m.title } -func (c Content) SetValue(value string) Content { - c.textarea.SetValue(value) - return c +func (m Model) SetValue(value string) Model { + m.textarea.SetValue(value) + return m } -func (c Content) SetCursorToStart() Content { +func (m Model) SetCursorToStart() Model { // textarea.Line() does not seem to return the correct current // line of the cursor. At least after setting a new value. // Thus, move the cursor up more than potentially needed to ensure // that we are at the very beginning of the text input. - for i := 0; i < c.textarea.LineCount(); i++ { - c.textarea.CursorUp() + for i := 0; i < m.textarea.LineCount(); i++ { + m.textarea.CursorUp() } - c.textarea.SetCursor(0) // Only moves to the beginning of the row - return c + m.textarea.SetCursor(0) // Only moves to the beginning of the row + return m } -func (c Content) SetSize(width, height int) container.Content { - c.width, c.height = width, height - c.textarea.SetWidth(width - 2) - c.textarea.SetHeight(height - 1) - return c +func (m Model) SetSize(width, height int) Model { + m.width, m.height = width, height + m.textarea.SetWidth(width - 2) + m.textarea.SetHeight(height - 1) + return m } -func (c Content) KeyMap() help.KeyMap { +func (m Model) KeyMap() help.KeyMap { return nil } -func (c Content) Text() string { - return c.textarea.Value() +func (m Model) Text() string { + return m.textarea.Value() } From 79ff2565715956e89706ab35ba153a74699f2dfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Ha=C3=9F?= Date: Wed, 15 Oct 2025 16:33:46 +0200 Subject: [PATCH 6/7] change char count in commit dialog (#32) * change char count in commit dialog - fix typo - only display if char count > 0 * fix build error --- internal/ui/textinput/textinput.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/internal/ui/textinput/textinput.go b/internal/ui/textinput/textinput.go index 3ef0ea8..c7dd351 100644 --- a/internal/ui/textinput/textinput.go +++ b/internal/ui/textinput/textinput.go @@ -75,15 +75,18 @@ func (m Model) UpdateFocus(isFocused bool) (Model, tea.Cmd) { func (m Model) View() string { inputLength := len([]rune(m.textarea.Value())) - count := countStyle. - MaxWidth(m.width - 2). - Render(fmt.Sprint("Chararcters ", inputLength)) - - countLine := lipgloss.PlaceHorizontal( - m.width-2, - lipgloss.Right, - count, - ) + var countLine string + if inputLength > 0 { + count := countStyle. + MaxWidth(m.width - 2). + Render(fmt.Sprintf("[%d chars]", inputLength)) + + countLine = lipgloss.PlaceHorizontal( + m.width-2, + lipgloss.Right, + count, + ) + } return lipgloss.JoinVertical( lipgloss.Top, From 631f0dfbf9499e25caab54d018c0a7846b33f988 Mon Sep 17 00:00:00 2001 From: michaelhass Date: Thu, 16 Oct 2025 07:45:37 +0200 Subject: [PATCH 7/7] clean up - remove index when accessing array - simplify cleanedPathString func --- internal/git/cmd.go | 2 +- internal/git/status.go | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/internal/git/cmd.go b/internal/git/cmd.go index 1f1d1c9..323a7d1 100644 --- a/internal/git/cmd.go +++ b/internal/git/cmd.go @@ -94,7 +94,7 @@ func newDiffCmd(opts DiffOptions) *gitCommand { } if opts.IsUntracked { - args = append(args, untrackedFileDiffArgs[:3]...) + args = append(args, untrackedFileDiffArgs[:]...) } if len(opts.FilePath) > 0 { diff --git a/internal/git/status.go b/internal/git/status.go index 5d9a0f5..40f46e7 100644 --- a/internal/git/status.go +++ b/internal/git/status.go @@ -110,15 +110,8 @@ func readFileStatusFromOutputComponent(component string) (FileStatus, error) { } func cleanedPathString(path string) string { - path = strings.TrimSuffix(path, " ") - path = strings.TrimPrefix(path, " ") - - if strings.Contains(path, " ") && - strings.HasPrefix(path, "\"") && - strings.HasSuffix(path, "\"") { - path = path[1 : len(path)-1] - } - + path = strings.Trim(path, " ") + path = strings.Trim(path, "\"") return path }