Skip to content

Commit

Permalink
better appearance for reverse attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseduffield committed Apr 16, 2022
1 parent 6a153ac commit 00afa30
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 37 deletions.
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

![CI](https://github.com/jesseduffield/lazygit/workflows/Continuous%20Integration/badge.svg) [![Go Report Card](https://goreportcard.com/badge/github.com/jesseduffield/lazygit)](https://goreportcard.com/report/github.com/jesseduffield/lazygit) [![GoDoc](https://godoc.org/github.com/jesseduffield/lazygit?status.svg)](https://godoc.org/github.com/jesseduffield/lazygit) [![GitHub tag](https://img.shields.io/github/tag/jesseduffield/lazygit.svg)](https://github.com/jesseduffield/lazygit/releases) [![TODOs](https://badgen.net/https/api.tickgit.com/badgen/github.com/jesseduffield/lazygit)](https://www.tickgit.com/browse?repo=github.com/jesseduffield/lazygit)

A simple terminal UI for git commands, written in Go with the [gocui](https://github.com/jroimartin/gocui "gocui") library.
A simple terminal UI for git commands, written in Go with the [gocui](https://github.com/jroimartin/gocui 'gocui') library.

Rant time: You've heard it before, git is _powerful_, but what good is that power when everything is so damn hard to do? Interactive rebasing requires you to edit a goddamn TODO file in your editor? *Are you kidding me?* To stage part of a file you need to use a command line program to step through each hunk and if a hunk can't be split down any further but contains code you don't want to stage, you have to edit an arcane patch file _by hand_? *Are you KIDDING me?!* Sometimes you get asked to stash your changes when switching branches only to realise that after you switch and unstash that there weren't even any conflicts and it would have been fine to just checkout the branch directly? *YOU HAVE GOT TO BE KIDDING ME!*
Rant time: You've heard it before, git is _powerful_, but what good is that power when everything is so damn hard to do? Interactive rebasing requires you to edit a goddamn TODO file in your editor? _Are you kidding me?_ To stage part of a file you need to use a command line program to step through each hunk and if a hunk can't be split down any further but contains code you don't want to stage, you have to edit an arcane patch file _by hand_? _Are you KIDDING me?!_ Sometimes you get asked to stash your changes when switching branches only to realise that after you switch and unstash that there weren't even any conflicts and it would have been fine to just checkout the branch directly? _YOU HAVE GOT TO BE KIDDING ME!_

If you're a mere mortal like me and you're tired of hearing how powerful git is when in your daily life it's a powerful pain in your ass, lazygit might be for you.

Expand Down Expand Up @@ -288,15 +288,11 @@ If you would like to support the development of lazygit, consider [sponsoring me

## FAQ

### I'm struggling to see the selected line

See [here](https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#struggling-to-see-selected-line)

### What do the commit colors represent?

* Green: the commit is included in the master branch
* Yellow: the commit is not included in the master branch
* Red: the commit has not been pushed to the upstream branch
- Green: the commit is included in the master branch
- Yellow: the commit is not included in the master branch
- Red: the commit has not been pushed to the upstream branch

## Shameless Plug

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/integrii/flaggy v1.4.0
github.com/jesseduffield/generics v0.0.0-20220320043834-727e535cbe68
github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4
github.com/jesseduffield/gocui v0.3.1-0.20220415000211-a826601ada29
github.com/jesseduffield/gocui v0.3.1-0.20220415005542-2eb424ce3d0a
github.com/jesseduffield/minimal/gitignore v0.3.3-0.20211018110810-9cde264e6b1e
github.com/jesseduffield/yaml v2.1.0+incompatible
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ github.com/jesseduffield/generics v0.0.0-20220320043834-727e535cbe68 h1:EQP2Tv8T
github.com/jesseduffield/generics v0.0.0-20220320043834-727e535cbe68/go.mod h1:+LLj9/WUPAP8LqCchs7P+7X0R98HiFujVFANdNaxhGk=
github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4 h1:GOQrmaE8i+KEdB8NzAegKYd4tPn/inM0I1uo0NXFerg=
github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4/go.mod h1:nGNEErzf+NRznT+N2SWqmHnDnF9aLgANB1CUNEan09o=
github.com/jesseduffield/gocui v0.3.1-0.20220415000211-a826601ada29 h1:2U/L4Z2gs0rRc6cSqT9UmHKME9rFaoHsOM3SWFE0uo4=
github.com/jesseduffield/gocui v0.3.1-0.20220415000211-a826601ada29/go.mod h1:znJuCDnF2Ph40YZSlBwdX/4GEofnIoWLGdT4mK5zRAU=
github.com/jesseduffield/gocui v0.3.1-0.20220415005542-2eb424ce3d0a h1:Fd8B7eZJfwK0cFzqz2gEFLEDiY0iwJTm6oBbPRHONxA=
github.com/jesseduffield/gocui v0.3.1-0.20220415005542-2eb424ce3d0a/go.mod h1:znJuCDnF2Ph40YZSlBwdX/4GEofnIoWLGdT4mK5zRAU=
github.com/jesseduffield/minimal/gitignore v0.3.3-0.20211018110810-9cde264e6b1e h1:uw/oo+kg7t/oeMs6sqlAwr85ND/9cpO3up3VxphxY0U=
github.com/jesseduffield/minimal/gitignore v0.3.3-0.20211018110810-9cde264e6b1e/go.mod h1:u60qdFGXRd36jyEXxetz0vQceQIxzI13lIo3EFUDf4I=
github.com/jesseduffield/yaml v2.1.0+incompatible h1:HWQJ1gIv2zHKbDYNp0Jwjlj24K8aqpFHnMCynY1EpmE=
Expand Down
20 changes: 8 additions & 12 deletions pkg/gui/presentation/files.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package presentation

import (
"fmt"
"strings"

"github.com/jesseduffield/lazygit/pkg/commands/models"
Expand All @@ -17,11 +16,12 @@ const (
COLLAPSED_ARROW = "►"
)

// keeping these here as individual constants in case later on people want the old tree shape
const (
INNER_ITEM = "├─ "
LAST_ITEM = "└─ "
NESTED = " "
NOTHING = " "
INNER_ITEM = " "
LAST_ITEM = " "
NESTED = " "
NOTHING = " "
)

func RenderFileTree(
Expand Down Expand Up @@ -77,24 +77,20 @@ func renderAux(

isRoot := depth == -1

renderLineWithPrefix := func() string {
return prefix + renderLine(s, depth)
}

if s.IsLeaf() {
if isRoot {
return []string{}
}
return []string{renderLineWithPrefix()}
return []string{prefix + renderLine(s, depth)}
}

if collapsedPaths.IsCollapsed(s.GetPath()) {
return []string{fmt.Sprintf("%s %s", renderLineWithPrefix(), COLLAPSED_ARROW)}
return []string{prefix + COLLAPSED_ARROW + " " + renderLine(s, depth)}
}

arr := []string{}
if !isRoot {
arr = append(arr, fmt.Sprintf("%s %s", renderLineWithPrefix(), EXPANDED_ARROW))
arr = append(arr, prefix+EXPANDED_ARROW+" "+renderLine(s, depth))
}

newPrefix := prefix
Expand Down
24 changes: 12 additions & 12 deletions pkg/gui/presentation/files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ func TestRenderFileTree(t *testing.T) {
},
expected: toStringSlice(
`
dir1 ►
dir2 ▼
├─ dir2 ▼
│ ├─ M file3
│ └─ M file4
└─ M file5
► dir1
▼ dir2
▼ dir2
M file3
M file4
M file5
M file1
`,
),
Expand Down Expand Up @@ -112,12 +112,12 @@ func TestRenderCommitFileTree(t *testing.T) {
},
expected: toStringSlice(
`
dir1 ►
dir2 ▼
├─ dir2 ▼
│ ├─ D file3
│ └─ M file4
└─ M file5
► dir1
▼ dir2
▼ dir2
D file3
M file4
M file5
M file1
`,
),
Expand Down
6 changes: 6 additions & 0 deletions vendor/github.com/jesseduffield/gocui/view.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ github.com/jesseduffield/go-git/v5/utils/merkletrie/filesystem
github.com/jesseduffield/go-git/v5/utils/merkletrie/index
github.com/jesseduffield/go-git/v5/utils/merkletrie/internal/frame
github.com/jesseduffield/go-git/v5/utils/merkletrie/noder
# github.com/jesseduffield/gocui v0.3.1-0.20220415000211-a826601ada29
# github.com/jesseduffield/gocui v0.3.1-0.20220415005542-2eb424ce3d0a
## explicit; go 1.12
github.com/jesseduffield/gocui
# github.com/jesseduffield/minimal/gitignore v0.3.3-0.20211018110810-9cde264e6b1e
Expand Down

0 comments on commit 00afa30

Please sign in to comment.