Compare commits

...
15 Commits
Author SHA1 Message Date
Jesse Duffield 579791e7bc Fix opening lazygit in a bare repo with specified worktree (#2902) 2023-08-07 22:48:14 +10:00
Jesse Duffield 595e28d335 Support bare worktrees where worktree does not have its own .git file
This was on oversight on my part: I assumed that the --work-tree arg was
always intended for use with linked worktrees which have a .git file
pointing back to the repo.

I'm honestly confused now: seems like there are three kinds of worktrees:
* the main worktree of a non-bare repo
* a linked worktree (with its own gitdir in the repo's worktrees/ dir)
* a random folder which you specify as a worktree with the --work-tree arg

I'm pretty sure the --work-tree arg is only intended to be used with this
third kind or workree
2023-08-07 22:40:53 +10:00
Jesse Duffield 0551f29de9 Test bare repos with dotfile setup 2023-08-07 22:21:23 +10:00
Jesse Duffield ecaf1e9002 Use nerdfont version 3 in demos (#2901) 2023-08-07 21:23:42 +10:00
Jesse Duffield 69ff621494 Use nerdfont version 3
Turns out I was on version 2 when recording these. I've switched
to v3 now.
2023-08-07 21:19:10 +10:00
Stefan Haller 2ded352f3a Don't run the check-required-label check on master (#2896) 2023-08-07 08:45:48 +02:00
Stefan Haller c877a8528f Don't run the check-required-label check on master
master doesn't have a label, so CI for master currently always fails.
2023-08-07 08:41:13 +02:00
Stefan Haller d1754a9490 update worktree icons for NerdFont V3 (#2895) 2023-08-07 08:16:42 +02:00
README-bot 33a96a3dd7 Updated README.md 2023-08-07 06:14:41 +00:00
Stefan Haller cd889adfa0 Import stefanhaller's tcell fork for real rather than just replacing it (#2888) 2023-08-07 08:14:28 +02:00
Saafo 77447ea6c3 👽️ update worktree icons for NerdFont V3 2023-08-07 05:47:57 +00:00
Stefan Haller 7ccb871a45 Bump gocui
... and import stefanhaller's tcell fork for real rather than just replacing it

This solves the problem that people trying to
"go install github.com/jesseduffield/lazygit@latest" would get the error

go: github.com/jesseduffield/lazygit@latest (in github.com/jesseduffield/lazygit@v0.40.0):
  The go.mod file for the module providing named packages contains one or
  more replace directives. It must not contain directives that would cause
  it to be interpreted differently than if it were the main module.
2023-08-06 12:03:23 +02:00
README-bot 9cc18bd7e6 Updated README.md 2023-08-06 06:29:45 +00:00
Stefan Haller 8e2ecd17a9 Fix README.md typo backkground -> background (#2884) 2023-08-06 08:29:32 +02:00
Mattias Johnson 78676dcff6 Fix README.md typo backkground -> background 2023-08-05 20:09:53 +02:00
163 changed files with 715 additions and 379 deletions
+1
View File
@@ -206,6 +206,7 @@ jobs:
if: ${{ failure() }}
check-required-label:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/master'
steps:
- uses: mheap/github-action-required-labels@v5
with:
+2 -2
View File
File diff suppressed because one or more lines are too long
+4 -1
View File
@@ -75,7 +75,10 @@ cursorStyle: block
# Font family
# You can use any font that is installed on your machine
# in CSS-like syntax
fontFamily: "DejaVuSansMono Nerd Font"
# Download from:
# https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.2/DejaVuSansMono.zip
# Not using the mono font because it makes icons too small.
fontFamily: "DejaVuSansM Nerd Font"
# The size of the font
fontSize: 8
+5 -7
View File
@@ -9,14 +9,13 @@ require (
github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21
github.com/creack/pty v1.1.11
github.com/fsmiamoto/git-todo-parser v0.0.5
github.com/gdamore/tcell/v2 v2.6.0
github.com/go-errors/errors v1.4.2
github.com/gookit/color v1.4.2
github.com/imdario/mergo v0.3.11
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.20221018185014-fdd53fef665d
github.com/jesseduffield/gocui v0.3.1-0.20230802092815-ae0a5c181634
github.com/jesseduffield/gocui v0.3.1-0.20230806095321-ac7b03108825
github.com/jesseduffield/kill v0.0.0-20220618033138-bfbe04675d10
github.com/jesseduffield/lazycore v0.0.0-20221012050358-03d2e40243c5
github.com/jesseduffield/minimal/gitignore v0.3.3-0.20211018110810-9cde264e6b1e
@@ -34,6 +33,7 @@ require (
github.com/sirupsen/logrus v1.4.2
github.com/spf13/afero v1.9.5
github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad
github.com/stefanhaller/tcell/v2 v2.6.2-0.20230806061358-2dfa11eddb68
github.com/stretchr/testify v1.8.0
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778
golang.org/x/exp v0.0.0-20220318154914-8dddf5d87bd8
@@ -67,10 +67,8 @@ require (
github.com/xanzy/ssh-agent v0.2.1 // indirect
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/term v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
)
replace github.com/gdamore/tcell/v2 v2.6.0 => github.com/stefanhaller/tcell/v2 v2.6.1
+10 -10
View File
@@ -179,8 +179,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.20221018185014-fdd53fef665d h1:bO+OmbreIv91rCe8NmscRwhFSqkDJtzWCPV4Y+SQuXE=
github.com/jesseduffield/go-git/v5 v5.1.2-0.20221018185014-fdd53fef665d/go.mod h1:nGNEErzf+NRznT+N2SWqmHnDnF9aLgANB1CUNEan09o=
github.com/jesseduffield/gocui v0.3.1-0.20230802092815-ae0a5c181634 h1:tL9DS59Po4kw1fR+wFn0zUYQhrgxMskTatLcYQl7MMU=
github.com/jesseduffield/gocui v0.3.1-0.20230802092815-ae0a5c181634/go.mod h1:pArPLsN1+S6jDrBDukTkpnH89rdhw44wzKdXFICGH3Q=
github.com/jesseduffield/gocui v0.3.1-0.20230806095321-ac7b03108825 h1:4Ea8qV/BbZAGcXd8MAufDsbwwfz2pbRZdqIodC/XHZs=
github.com/jesseduffield/gocui v0.3.1-0.20230806095321-ac7b03108825/go.mod h1:trXE7RRGL2hTsv+Ntk+SHLtRobg9JE138n3Ug/X2Cf4=
github.com/jesseduffield/kill v0.0.0-20220618033138-bfbe04675d10 h1:jmpr7KpX2+2GRiE91zTgfq49QvgiqB0nbmlwZ8UnOx0=
github.com/jesseduffield/kill v0.0.0-20220618033138-bfbe04675d10/go.mod h1:aA97kHeNA+sj2Hbki0pvLslmE4CbDyhBeSSTUUnOuVo=
github.com/jesseduffield/lazycore v0.0.0-20221012050358-03d2e40243c5 h1:CDuQmfOjAtb1Gms6a1p5L2P8RhbLUq5t8aL7PiQd2uY=
@@ -268,8 +268,8 @@ github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM=
github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ=
github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad h1:fiWzISvDn0Csy5H0iwgAuJGQTUpVfEMJJd4nRFXogbc=
github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0=
github.com/stefanhaller/tcell/v2 v2.6.1 h1:Qo4k5SOUc09q9xyA8juH4jFJy+neM9aQwJHgVO2/zBM=
github.com/stefanhaller/tcell/v2 v2.6.1/go.mod h1:PuJ7T6QKbsU7iVOHlhRoV3D/ipIAJsyiV4dbwcVaYj8=
github.com/stefanhaller/tcell/v2 v2.6.2-0.20230806061358-2dfa11eddb68 h1:NSTj9xAKUu85d6pAdNFyblL84BfiOB1rVnzxQO/cYUk=
github.com/stefanhaller/tcell/v2 v2.6.2-0.20230806061358-2dfa11eddb68/go.mod h1:PuJ7T6QKbsU7iVOHlhRoV3D/ipIAJsyiV4dbwcVaYj8=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4=
@@ -451,13 +451,13 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c=
golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o=
golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -467,8 +467,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+10 -14
View File
@@ -63,8 +63,17 @@ func Start(buildInfo *BuildInfo, integrationTest integrationTypes.IntegrationTes
log.Fatal(absRepoPath + " is not a valid git repository.")
}
cliArgs.WorkTree = absRepoPath
cliArgs.GitDir = filepath.Join(absRepoPath, ".git")
err = os.Chdir(absRepoPath)
if err != nil {
log.Fatalf("Failed to change directory to %s: %v", absRepoPath, err)
}
} else if cliArgs.WorkTree != "" {
env.SetWorkTreeEnv(cliArgs.WorkTree)
if err := os.Chdir(cliArgs.WorkTree); err != nil {
log.Fatalf("Failed to change directory to %s: %v", cliArgs.WorkTree, err)
}
}
if cliArgs.CustomConfigFile != "" {
@@ -75,13 +84,6 @@ func Start(buildInfo *BuildInfo, integrationTest integrationTypes.IntegrationTes
os.Setenv("CONFIG_DIR", cliArgs.UseConfigDir)
}
if cliArgs.WorkTree != "" {
err := os.Chdir(cliArgs.WorkTree)
if err != nil {
log.Fatalf("Failed to change directory to %s: %v", cliArgs.WorkTree, err)
}
}
if cliArgs.GitDir != "" {
env.SetGitDirEnv(cliArgs.GitDir)
}
@@ -118,12 +120,6 @@ func Start(buildInfo *BuildInfo, integrationTest integrationTypes.IntegrationTes
os.Exit(0)
}
if cliArgs.WorkTree != "" {
if err := os.Chdir(cliArgs.WorkTree); err != nil {
log.Fatal(err.Error())
}
}
tempDir, err := os.MkdirTemp("", "lazygit-*")
if err != nil {
log.Fatal(err.Error())
+18 -4
View File
@@ -91,10 +91,24 @@ func getRepoPathsAux(
if err != nil {
return nil, errors.Errorf("failed to get repo git dir path: %v", err)
}
worktreeGitDirPath, err := worktreeGitDirPath(fs, currentPath)
if err != nil {
return nil, errors.Errorf("failed to get worktree git dir path: %v", err)
var worktreeGitDirPath string
if env.GetWorkTreeEnv() != "" {
// This env is set when you pass --work-tree to lazygit. In that case,
// we're not dealing with a linked work-tree, we're dealing with a 'specified'
// worktree (for lack of a better term). In this case, the worktree has no
// .git file and it just contains a bunch of files: it has no idea it's
// pointed to by a bare repo. As such it does not have its own git dir within
// the bare repo's git dir. Instead, we just use the bare repo's git dir.
worktreeGitDirPath = repoGitDirPath
} else {
var err error
worktreeGitDirPath, err = getWorktreeGitDirPath(fs, currentPath)
if err != nil {
return nil, errors.Errorf("failed to get worktree git dir path: %v", err)
}
}
repoName := path.Base(repoPath)
return &RepoPaths{
@@ -110,7 +124,7 @@ func getRepoPathsAux(
// Returns the path of the git-dir for the worktree. For linked worktrees, the worktree has
// a .git file that points to the git-dir (which itself lives in the git-dir
// of the repo)
func worktreeGitDirPath(fs afero.Fs, worktreePath string) (string, error) {
func getWorktreeGitDirPath(fs afero.Fs, worktreePath string) (string, error) {
// if .git is a file, we're in a linked worktree, otherwise we're in
// the main worktree
dotGitPath := path.Join(worktreePath, ".git")
+1 -1
View File
@@ -58,7 +58,7 @@ func (self *WorktreeLoader) GetWorktrees() ([]*models.Worktree, error) {
isPathMissing := self.pathExists(path)
var gitDir string
gitDir, err := worktreeGitDirPath(self.Fs, path)
gitDir, err := getWorktreeGitDirPath(self.Fs, path)
if err != nil {
self.Log.Warnf("Could not find git dir for worktree %s: %v", path, err)
}
+10 -1
View File
@@ -14,6 +14,15 @@ func SetGitDirEnv(value string) {
os.Setenv("GIT_DIR", value)
}
func UnsetGitDirEnv() {
func GetWorkTreeEnv() string {
return os.Getenv("GIT_WORK_TREE")
}
func SetWorkTreeEnv(value string) {
os.Setenv("GIT_WORK_TREE", value)
}
func UnsetGitLocationEnvVars() {
_ = os.Unsetenv("GIT_DIR")
_ = os.Unsetenv("GIT_WORK_TREE")
}
+1 -1
View File
@@ -145,7 +145,7 @@ func (self *ReposHelper) DispatchSwitchToRepo(path string, contextKey types.Cont
func (self *ReposHelper) DispatchSwitchTo(path string, errMsg string, contextKey types.ContextKey) error {
return self.c.WithWaitingStatus(self.c.Tr.Switching, func(gocui.Task) error {
env.UnsetGitDirEnv()
env.UnsetGitLocationEnvVars()
originalPath, err := os.Getwd()
if err != nil {
return nil
+1 -1
View File
@@ -6,13 +6,13 @@ import (
"strings"
"time"
"github.com/gdamore/tcell/v2"
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/gui/keybindings"
"github.com/jesseduffield/lazygit/pkg/gui/types"
integrationTypes "github.com/jesseduffield/lazygit/pkg/integration/types"
"github.com/stefanhaller/tcell/v2"
)
// this gives our integration test a way of interacting with the gui for sending keypresses
+8 -6
View File
@@ -14,8 +14,8 @@ var (
MERGE_COMMIT_ICON = "\U000f062d" // 󰘭
DEFAULT_REMOTE_ICON = "\uf02a2" // 󰊢
STASH_ICON = "\uf01c" // 
LINKED_WORKTREE_ICON = "\uf838" //
MISSING_LINKED_WORKTREE_ICON = "\uf839" //
LINKED_WORKTREE_ICON = "\U000f0339" // 󰌹
MISSING_LINKED_WORKTREE_ICON = "\U000f033a" // 󰌺
)
var remoteIcons = map[string]string{
@@ -26,10 +26,12 @@ var remoteIcons = map[string]string{
}
func patchGitIconsForNerdFontsV2() {
BRANCH_ICON = "\ufb2b" // שׂ
COMMIT_ICON = "\ufc16" // ﰖ
MERGE_COMMIT_ICON = "\ufb2c" // שּׁ
DEFAULT_REMOTE_ICON = "\uf7a1" // 
BRANCH_ICON = "\ufb2b" // שׂ
COMMIT_ICON = "\ufc16" // ﰖ
MERGE_COMMIT_ICON = "\ufb2c" // שּׁ
DEFAULT_REMOTE_ICON = "\uf7a1" // 
LINKED_WORKTREE_ICON = "\uf838" // 
MISSING_LINKED_WORKTREE_ICON = "\uf839" // 
remoteIcons["dev.azure.com"] = "\ufd03" // ﴃ
}
-7
View File
@@ -27,13 +27,6 @@ func (self Paths) ActualRepo() string {
return filepath.Join(self.Actual(), "repo")
}
// When an integration test first runs, we copy everything in the 'actual' directory,
// and copy it into the 'expected' directory so that future runs can be compared
// against what we expect.
func (self Paths) Expected() string {
return filepath.Join(self.root, "expected")
}
func (self Paths) Config() string {
return filepath.Join(self.root, "used_config")
}
+15 -4
View File
@@ -6,9 +6,11 @@ import (
"os/exec"
"path/filepath"
"github.com/jesseduffield/lazycore/pkg/utils"
lazycoreUtils "github.com/jesseduffield/lazycore/pkg/utils"
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
"github.com/jesseduffield/lazygit/pkg/utils"
"github.com/samber/lo"
)
const (
@@ -30,7 +32,7 @@ func RunTests(
keyPressDelay int,
maxAttempts int,
) error {
projectRootDir := utils.GetLazyRootDirectory()
projectRootDir := lazycoreUtils.GetLazyRootDirectory()
err := os.Chdir(projectRootDir)
if err != nil {
return err
@@ -177,8 +179,17 @@ func getLazygitCommand(test *IntegrationTest, paths Paths, rootDir string, sandb
return nil, err
}
cmdArgs := []string{tempLazygitPath(), "-debug", "--use-config-dir=" + paths.Config(), "--path=" + paths.ActualRepo()}
cmdArgs = append(cmdArgs, test.ExtraCmdArgs()...)
cmdArgs := []string{tempLazygitPath(), "-debug", "--use-config-dir=" + paths.Config()}
if !test.useCustomPath {
cmdArgs = append(cmdArgs, "--path="+paths.ActualRepo())
}
resolvedExtraArgs := lo.Map(test.ExtraCmdArgs(), func(arg string, _ int) string {
return utils.ResolvePlaceholderString(arg, map[string]string{
"actualPath": paths.Actual(),
"actualRepoPath": paths.ActualRepo(),
})
})
cmdArgs = append(cmdArgs, resolvedExtraArgs...)
cmdObj := osCommand.Cmd.New(cmdArgs)
+22 -16
View File
@@ -35,10 +35,11 @@ type IntegrationTest struct {
testDriver *TestDriver,
keys config.KeybindingConfig,
)
gitVersion GitVersionRestriction
width int
height int
isDemo bool
gitVersion GitVersionRestriction
width int
height int
isDemo bool
useCustomPath bool
}
var _ integrationTypes.IntegrationTest = &IntegrationTest{}
@@ -66,6 +67,10 @@ type NewIntegrationTestArgs struct {
Height int
// If true, this is not a test but a demo to be added to our docs
IsDemo bool
// If true, the test won't invoke lazygit with the --path arg.
// Useful for when we're passing --git-dir and --work-tree (because --path is
// incompatible with those args)
UseCustomPath bool
}
type GitVersionRestriction struct {
@@ -125,18 +130,19 @@ func NewIntegrationTest(args NewIntegrationTestArgs) *IntegrationTest {
}
return &IntegrationTest{
name: name,
description: args.Description,
extraCmdArgs: args.ExtraCmdArgs,
extraEnvVars: args.ExtraEnvVars,
skip: args.Skip,
setupRepo: args.SetupRepo,
setupConfig: args.SetupConfig,
run: args.Run,
gitVersion: args.GitVersion,
width: args.Width,
height: args.Height,
isDemo: args.IsDemo,
name: name,
description: args.Description,
extraCmdArgs: args.ExtraCmdArgs,
extraEnvVars: args.ExtraEnvVars,
skip: args.Skip,
setupRepo: args.SetupRepo,
setupConfig: args.SetupConfig,
run: args.Run,
gitVersion: args.GitVersion,
width: args.Width,
height: args.Height,
isDemo: args.IsDemo,
useCustomPath: args.UseCustomPath,
}
}
@@ -11,9 +11,7 @@ var AmendOldCommit = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
// No idea why I had to use version 2: it should be using my own computer's
// font and the one iterm uses is version 3.
config.UserConfig.Gui.NerdFontsVersion = "2"
config.UserConfig.Gui.NerdFontsVersion = "3"
config.UserConfig.Gui.ShowFileTree = false
},
SetupRepo: func(shell *Shell) {
+1 -3
View File
@@ -11,9 +11,7 @@ var Bisect = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
// No idea why I had to use version 2: it should be using my own computer's
// font and the one iterm uses is version 3.
config.UserConfig.Gui.NerdFontsVersion = "2"
config.UserConfig.Gui.NerdFontsVersion = "3"
},
SetupRepo: func(shell *Shell) {
shell.CreateFile("my-file.txt", "myfile content")
+1 -3
View File
@@ -11,9 +11,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
// No idea why I had to use version 2: it should be using my own computer's
// font and the one iterm uses is version 3.
config.UserConfig.Gui.NerdFontsVersion = "2"
config.UserConfig.Gui.NerdFontsVersion = "3"
},
SetupRepo: func(shell *Shell) {
shell.CreateNCommitsWithRandomMessages(50)
@@ -11,9 +11,7 @@ var CommitAndPush = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
// No idea why I had to use version 2: it should be using my own computer's
// font and the one iterm uses is version 3.
config.UserConfig.Gui.NerdFontsVersion = "2"
config.UserConfig.Gui.NerdFontsVersion = "3"
},
SetupRepo: func(shell *Shell) {
shell.CreateFile("my-file.txt", "myfile content")
+1 -3
View File
@@ -21,9 +21,7 @@ var CustomPatch = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(cfg *config.AppConfig) {
// No idea why I had to use version 2: it should be using my own computer's
// font and the one iterm uses is version 3.
cfg.UserConfig.Gui.NerdFontsVersion = "2"
cfg.UserConfig.Gui.NerdFontsVersion = "3"
},
SetupRepo: func(shell *Shell) {
shell.CreateNCommitsWithRandomMessages(30)
+1 -3
View File
@@ -11,9 +11,7 @@ var Filter = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
// No idea why I had to use version 2: it should be using my own computer's
// font and the one iterm uses is version 3.
config.UserConfig.Gui.NerdFontsVersion = "2"
config.UserConfig.Gui.NerdFontsVersion = "3"
},
SetupRepo: func(shell *Shell) {
shell.CreateNCommitsWithRandomMessages(30)
@@ -11,9 +11,7 @@ var InteractiveRebase = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
// No idea why I had to use version 2: it should be using my own computer's
// font and the one iterm uses is version 3.
config.UserConfig.Gui.NerdFontsVersion = "2"
config.UserConfig.Gui.NerdFontsVersion = "3"
},
SetupRepo: func(shell *Shell) {
shell.CreateFile("my-file.txt", "myfile content")
@@ -11,9 +11,7 @@ var NukeWorkingTree = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
// No idea why I had to use version 2: it should be using my own computer's
// font and the one iterm uses is version 3.
config.UserConfig.Gui.NerdFontsVersion = "2"
config.UserConfig.Gui.NerdFontsVersion = "3"
config.UserConfig.Gui.AnimateExplosion = true
},
SetupRepo: func(shell *Shell) {
+1 -3
View File
@@ -39,9 +39,7 @@ var StageLines = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
// No idea why I had to use version 2: it should be using my own computer's
// font and the one iterm uses is version 3.
config.UserConfig.Gui.NerdFontsVersion = "2"
config.UserConfig.Gui.NerdFontsVersion = "3"
config.UserConfig.Gui.ShowFileTree = false
config.UserConfig.Gui.ShowCommandLog = false
},
+1 -3
View File
@@ -13,9 +13,7 @@ var Undo = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
// No idea why I had to use version 2: it should be using my own computer's
// font and the one iterm uses is version 3.
config.UserConfig.Gui.NerdFontsVersion = "2"
config.UserConfig.Gui.NerdFontsVersion = "3"
},
SetupRepo: func(shell *Shell) {
shell.CreateNCommitsWithRandomMessages(30)
+1
View File
@@ -245,6 +245,7 @@ var tests = []*components.IntegrationTest{
worktree.Crud,
worktree.CustomCommand,
worktree.DetachWorktreeFromBranch,
worktree.DotfileBareRepo,
worktree.FastForwardWorktreeBranch,
worktree.ForceRemoveWorktree,
worktree.RemoveWorktreeFromBranch,
@@ -0,0 +1,74 @@
package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// Can't think of a better name than 'dotfile' repo: I'm using that
// because that's the case we're typically dealing with.
var DotfileBareRepo = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Open lazygit in the worktree of a dotfile bare repo and add a file and commit",
ExtraCmdArgs: []string{"--git-dir={{.actualPath}}/.bare", "--work-tree={{.actualPath}}/repo"},
Skip: false,
// passing this because we're explicitly passing --git-dir and --work-tree args
UseCustomPath: true,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
// we're going to have a directory structure like this:
// project
// - .bare
// - repo (the worktree)
//
// The first repo is called 'repo' because that's the
// directory that all lazygit tests start in
// Delete the .git dir that all tests start with by default
shell.DeleteFile(".git")
// Create a bare repo in the parent directory
shell.RunCommand([]string{"git", "init", "--bare", "../.bare"})
shell.RunCommand([]string{"git", "--git-dir=../.bare", "--work-tree=.", "checkout", "-b", "mybranch"})
shell.CreateFile("blah", "original content\n")
// Add a file and commit
shell.RunCommand([]string{"git", "--git-dir=../.bare", "--work-tree=.", "add", "blah"})
shell.RunCommand([]string{"git", "--git-dir=../.bare", "--work-tree=.", "commit", "-m", "initial commit"})
shell.UpdateFile("blah", "updated content\n")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Lines(
Contains("mybranch"),
)
t.Views().Commits().
Lines(
Contains("initial commit"),
)
t.Views().Files().
IsFocused().
Lines(
Contains(" M blah"), // shows as modified
).
PressPrimaryAction().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
Type("Add blah").
Confirm()
t.Views().Files().
IsEmpty()
t.Views().Commits().
Lines(
Contains("Add blah"),
Contains("initial commit"),
)
},
})
-58
View File
@@ -1,58 +0,0 @@
// Copyright 2020 The TCell Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use file except in compliance with the License.
// You may obtain a copy of the license at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package extended contains an extended set of terminal descriptions.
// Applications desiring to have a better chance of Just Working by
// default should include this package. This will significantly increase
// the size of the program.
package extended
import (
// The following imports just register themselves --
// these are the terminal types we aggregate in this package.
_ "github.com/gdamore/tcell/v2/terminfo/a/aixterm"
_ "github.com/gdamore/tcell/v2/terminfo/a/alacritty"
_ "github.com/gdamore/tcell/v2/terminfo/a/ansi"
_ "github.com/gdamore/tcell/v2/terminfo/b/beterm"
_ "github.com/gdamore/tcell/v2/terminfo/c/cygwin"
_ "github.com/gdamore/tcell/v2/terminfo/d/dtterm"
_ "github.com/gdamore/tcell/v2/terminfo/e/emacs"
_ "github.com/gdamore/tcell/v2/terminfo/f/foot"
_ "github.com/gdamore/tcell/v2/terminfo/g/gnome"
_ "github.com/gdamore/tcell/v2/terminfo/h/hpterm"
_ "github.com/gdamore/tcell/v2/terminfo/k/konsole"
_ "github.com/gdamore/tcell/v2/terminfo/k/kterm"
_ "github.com/gdamore/tcell/v2/terminfo/l/linux"
_ "github.com/gdamore/tcell/v2/terminfo/p/pcansi"
_ "github.com/gdamore/tcell/v2/terminfo/r/rxvt"
_ "github.com/gdamore/tcell/v2/terminfo/s/screen"
_ "github.com/gdamore/tcell/v2/terminfo/s/simpleterm"
_ "github.com/gdamore/tcell/v2/terminfo/s/sun"
_ "github.com/gdamore/tcell/v2/terminfo/t/termite"
_ "github.com/gdamore/tcell/v2/terminfo/t/tmux"
_ "github.com/gdamore/tcell/v2/terminfo/v/vt100"
_ "github.com/gdamore/tcell/v2/terminfo/v/vt102"
_ "github.com/gdamore/tcell/v2/terminfo/v/vt220"
_ "github.com/gdamore/tcell/v2/terminfo/v/vt320"
_ "github.com/gdamore/tcell/v2/terminfo/v/vt400"
_ "github.com/gdamore/tcell/v2/terminfo/v/vt420"
_ "github.com/gdamore/tcell/v2/terminfo/v/vt52"
_ "github.com/gdamore/tcell/v2/terminfo/w/wy50"
_ "github.com/gdamore/tcell/v2/terminfo/w/wy60"
_ "github.com/gdamore/tcell/v2/terminfo/w/wy99_ansi"
_ "github.com/gdamore/tcell/v2/terminfo/x/xfce"
_ "github.com/gdamore/tcell/v2/terminfo/x/xterm"
_ "github.com/gdamore/tcell/v2/terminfo/x/xterm_kitty"
_ "github.com/gdamore/tcell/v2/terminfo/x/xterm_termite"
)
+1 -1
View File
@@ -4,7 +4,7 @@
package gocui
import "github.com/gdamore/tcell/v2"
import "github.com/stefanhaller/tcell/v2"
// Attribute affects the presentation of characters, such as color, boldness, etc.
type Attribute uint64
+1 -1
View File
@@ -12,9 +12,9 @@ import (
"sync"
"time"
"github.com/gdamore/tcell/v2"
"github.com/go-errors/errors"
"github.com/mattn/go-runewidth"
"github.com/stefanhaller/tcell/v2"
)
// OutputMode represents an output mode, which determines how colors
+1 -1
View File
@@ -7,7 +7,7 @@ package gocui
import (
"strings"
"github.com/gdamore/tcell/v2"
"github.com/stefanhaller/tcell/v2"
)
// Key represents special keys or keys combinations.
+1 -1
View File
@@ -5,8 +5,8 @@
package gocui
import (
"github.com/gdamore/tcell/v2"
"github.com/mattn/go-runewidth"
"github.com/stefanhaller/tcell/v2"
)
// We probably don't want this being a global variable for YOLO for now
+1 -1
View File
@@ -13,9 +13,9 @@ import (
"unicode"
"unicode/utf8"
"github.com/gdamore/tcell/v2"
"github.com/go-errors/errors"
"github.com/mattn/go-runewidth"
"github.com/stefanhaller/tcell/v2"
)
// Constants for overlapping edges
@@ -172,7 +172,7 @@ import (
"fmt"
"log"
"github.com/gdamore/tcell/v2"
"github.com/stefanhaller/tcell/v2"
)
func drawText(s tcell.Screen, x1, y1, x2, y2 int, style tcell.Style, text string) {
@@ -18,7 +18,7 @@ import (
"errors"
"time"
"github.com/gdamore/tcell/v2/terminfo"
"github.com/stefanhaller/tcell/v2/terminfo"
)
var (
@@ -2,7 +2,7 @@
package aixterm
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package alacritty
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package alacritty
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package ansi
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package beterm
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -24,9 +24,9 @@ package base
import (
// The following imports just register themselves --
// thse are the terminal types we aggregate in this package.
_ "github.com/gdamore/tcell/v2/terminfo/a/ansi"
_ "github.com/gdamore/tcell/v2/terminfo/v/vt100"
_ "github.com/gdamore/tcell/v2/terminfo/v/vt102"
_ "github.com/gdamore/tcell/v2/terminfo/v/vt220"
_ "github.com/gdamore/tcell/v2/terminfo/x/xterm"
_ "github.com/stefanhaller/tcell/v2/terminfo/a/ansi"
_ "github.com/stefanhaller/tcell/v2/terminfo/v/vt100"
_ "github.com/stefanhaller/tcell/v2/terminfo/v/vt102"
_ "github.com/stefanhaller/tcell/v2/terminfo/v/vt220"
_ "github.com/stefanhaller/tcell/v2/terminfo/x/xterm"
)
@@ -2,7 +2,7 @@
package cygwin
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package dtterm
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -29,7 +29,7 @@ import (
"strconv"
"strings"
"github.com/gdamore/tcell/v2/terminfo"
"github.com/stefanhaller/tcell/v2/terminfo"
)
type termcap struct {
@@ -2,7 +2,7 @@
package emacs
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
+58
View File
@@ -0,0 +1,58 @@
// Copyright 2020 The TCell Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use file except in compliance with the License.
// You may obtain a copy of the license at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package extended contains an extended set of terminal descriptions.
// Applications desiring to have a better chance of Just Working by
// default should include this package. This will significantly increase
// the size of the program.
package extended
import (
// The following imports just register themselves --
// these are the terminal types we aggregate in this package.
_ "github.com/stefanhaller/tcell/v2/terminfo/a/aixterm"
_ "github.com/stefanhaller/tcell/v2/terminfo/a/alacritty"
_ "github.com/stefanhaller/tcell/v2/terminfo/a/ansi"
_ "github.com/stefanhaller/tcell/v2/terminfo/b/beterm"
_ "github.com/stefanhaller/tcell/v2/terminfo/c/cygwin"
_ "github.com/stefanhaller/tcell/v2/terminfo/d/dtterm"
_ "github.com/stefanhaller/tcell/v2/terminfo/e/emacs"
_ "github.com/stefanhaller/tcell/v2/terminfo/f/foot"
_ "github.com/stefanhaller/tcell/v2/terminfo/g/gnome"
_ "github.com/stefanhaller/tcell/v2/terminfo/h/hpterm"
_ "github.com/stefanhaller/tcell/v2/terminfo/k/konsole"
_ "github.com/stefanhaller/tcell/v2/terminfo/k/kterm"
_ "github.com/stefanhaller/tcell/v2/terminfo/l/linux"
_ "github.com/stefanhaller/tcell/v2/terminfo/p/pcansi"
_ "github.com/stefanhaller/tcell/v2/terminfo/r/rxvt"
_ "github.com/stefanhaller/tcell/v2/terminfo/s/screen"
_ "github.com/stefanhaller/tcell/v2/terminfo/s/simpleterm"
_ "github.com/stefanhaller/tcell/v2/terminfo/s/sun"
_ "github.com/stefanhaller/tcell/v2/terminfo/t/termite"
_ "github.com/stefanhaller/tcell/v2/terminfo/t/tmux"
_ "github.com/stefanhaller/tcell/v2/terminfo/v/vt100"
_ "github.com/stefanhaller/tcell/v2/terminfo/v/vt102"
_ "github.com/stefanhaller/tcell/v2/terminfo/v/vt220"
_ "github.com/stefanhaller/tcell/v2/terminfo/v/vt320"
_ "github.com/stefanhaller/tcell/v2/terminfo/v/vt400"
_ "github.com/stefanhaller/tcell/v2/terminfo/v/vt420"
_ "github.com/stefanhaller/tcell/v2/terminfo/v/vt52"
_ "github.com/stefanhaller/tcell/v2/terminfo/w/wy50"
_ "github.com/stefanhaller/tcell/v2/terminfo/w/wy60"
_ "github.com/stefanhaller/tcell/v2/terminfo/w/wy99_ansi"
_ "github.com/stefanhaller/tcell/v2/terminfo/x/xfce"
_ "github.com/stefanhaller/tcell/v2/terminfo/x/xterm"
_ "github.com/stefanhaller/tcell/v2/terminfo/x/xterm_kitty"
_ "github.com/stefanhaller/tcell/v2/terminfo/x/xterm_termite"
)
@@ -2,7 +2,7 @@
package foot
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package gnome
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package hpterm
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package konsole
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package kterm
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package linux
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package pcansi
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package rxvt
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package screen
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package simpleterm
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -20,7 +20,7 @@
package sun
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package termite
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package tmux
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package vt100
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package vt102
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {
@@ -2,7 +2,7 @@
package vt220
import "github.com/gdamore/tcell/v2/terminfo"
import "github.com/stefanhaller/tcell/v2/terminfo"
func init() {

Some files were not shown because too many files have changed in this diff Show More