From c38dc16def47bd4b5d2dcdeaeaa9a0ab768bfeb3 Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Sun, 5 Aug 2018 20:31:50 +0200 Subject: [PATCH 01/19] add instalation instructions for ubuntu --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9fdddb0a4..bc2cd856c 100644 --- a/README.md +++ b/README.md @@ -16,11 +16,22 @@ then just call `lazygit` in your terminal inside a git repository If you want, you can also add an alias for this with `echo "alias lg='lazygit'" >> ~/.zshrc` (or whichever rc file you're using) +### Ubuntu +Packages for Ubuntu 14.04 and up are available via Launchpad PPA. + +They are built daily, straight from master branch. + +```sh +sudo add-apt-repository ppa:lazygit-team/daily +sudo apt-get update +sudo apt-get install lazygit +``` + ## Cool features - Adding files easily - Resolving merge conflicts - Easily check out recent branches -- Scroll through logs/diffs of branches/commits/stash +- Scroll through logs/diffs of branches/commits/stash - Quick pushing/pulling - Squash down and rename commits From a02d3a0c4ee6d5bb8e3365cb7bf7934f9b3a9a77 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 6 Aug 2018 21:13:52 +1000 Subject: [PATCH 02/19] show graph when selecting branch in branch panel --- branches_panel.go | 2 +- gitcommands.go | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/branches_panel.go b/branches_panel.go index 8a65719a4..90cb66d8b 100644 --- a/branches_panel.go +++ b/branches_panel.go @@ -90,7 +90,7 @@ func handleBranchSelect(g *gocui.Gui, v *gocui.View) error { } go func() { branch := getSelectedBranch(v) - diff, _ := getBranchDiff(branch.Name, branch.BaseBranch) + diff, _ := getBranchGraph(branch.Name, branch.BaseBranch) renderString(g, "main", diff) }() return nil diff --git a/gitcommands.go b/gitcommands.go index 27e4e8369..d4433b1c3 100644 --- a/gitcommands.go +++ b/gitcommands.go @@ -327,10 +327,15 @@ func sublimeOpenFile(filename string) (string, error) { return runCommand("subl " + filename) } -func getBranchDiff(branch string, baseBranch string) (string, error) { +func getBranchGraph(branch string, baseBranch string) (string, error) { - return runCommand("git log -p -30 --color --no-merges " + branch) - // return runCommand("git diff --color " + baseBranch + "..." + branch) + return runCommand("git log --graph --color --abbrev-commit --decorate --date=relative --pretty=medium " + branch) + + // return runCommand("git log --color --graph --oneline " + branch) + + // Leaving this guy commented out in case there's backlash from the design + // change and I want to make this configurable + // return runCommand("git log -p -30 --color --no-merges " + branch) } func verifyInGitRepo() { From caea6497335b4f8cfab06ec29dec8f2e2daa7fac Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 6 Aug 2018 21:14:01 +1000 Subject: [PATCH 03/19] remove old comment --- gitcommands.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/gitcommands.go b/gitcommands.go index d4433b1c3..eabf23482 100644 --- a/gitcommands.go +++ b/gitcommands.go @@ -328,11 +328,8 @@ func sublimeOpenFile(filename string) (string, error) { } func getBranchGraph(branch string, baseBranch string) (string, error) { - return runCommand("git log --graph --color --abbrev-commit --decorate --date=relative --pretty=medium " + branch) - // return runCommand("git log --color --graph --oneline " + branch) - // Leaving this guy commented out in case there's backlash from the design // change and I want to make this configurable // return runCommand("git log -p -30 --color --no-merges " + branch) From afc3d4a997f07564b8e54c9cb801bd4f8841a324 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 6 Aug 2018 21:32:43 +1000 Subject: [PATCH 04/19] add keybindings doc --- docs/Keybindings.md | 52 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 docs/Keybindings.md diff --git a/docs/Keybindings.md b/docs/Keybindings.md new file mode 100644 index 000000000..cc78499c3 --- /dev/null +++ b/docs/Keybindings.md @@ -0,0 +1,52 @@ +# Keybindings: + +## Global: + + ← → ↑ ↓: navigate + PgUp/PgDn: scroll diff panel + q: quit + +## Files Panel: + + space: toggle staged + c: commit changes + shift+S: stash files + o: open (osx only) + s: open in sublime (requires 'code' command) + v: open in vscode (requires 'subl' command) + i: add to .gitignore + d: delete if untracked checkout if tracked (aka go away) + shift+R: refresh files + +## Branches Panel: + + space: checkout branch + f: force checkout branch + m: merge into currently checked out branch + c: checkout by name + n: new branch + +## Commits Panel: + + s: squash down (only available for topmost commit) + r: rename commit + g: reset to this commit + +## Stash Panel: + + space: apply + k: pop + d: drop + +## Popup Panel: + + esc: close/cancel + enter: confirm + +## Resolving Merge Conflicts (Diff Panel): + + ← →: navigate conflicts + ↑ ↓: select hunk + space: pick hunk + b: pick both hunks + z: undo (only available while still inside diff panel) From fbc09e209392a84d67734e142ca6d1ae6e263768 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 6 Aug 2018 21:35:30 +1000 Subject: [PATCH 05/19] add keybindings doc to readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index d1259c367..a2567a8d5 100644 --- a/README.md +++ b/README.md @@ -42,5 +42,8 @@ sudo apt-get install lazygit ### Viewing commit diffs ![Viewing Commit Diffs](https://image.ibb.co/gPD02o/capture.png) +## Docs +[Keybindings](https://github.com/jesseduffield/lazygit/blob/master/docs/Keybindings.md) + ## Work in progress This is still a work in progress so there's still bugs to iron out and as this is my first project in Go the code could no doubt use an increase in quality, but I'll be improving on it whenever I find the time. If you have any feedback feel free to [raise an issue](https://github.com/jesseduffield/lazygit/issues)/[submit a PR](https://github.com/jesseduffield/lazygit/pulls). From 69378b8ff4a0ba1785cd0d29f9f95dc14b8dab31 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 6 Aug 2018 21:47:46 +1000 Subject: [PATCH 06/19] add documentation comment about osx scrolling --- docs/Keybindings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Keybindings.md b/docs/Keybindings.md index cc78499c3..e224bcbee 100644 --- a/docs/Keybindings.md +++ b/docs/Keybindings.md @@ -3,7 +3,7 @@ ## Global: ← → ↑ ↓: navigate - PgUp/PgDn: scroll diff panel + PgUp/PgDn: scroll diff panel (use fn+up/down on osx) q: quit ## Files Panel: From 17cf4cec31a2e96a9a8297eb6cc12abe4153d6e2 Mon Sep 17 00:00:00 2001 From: "Tomas Alejandro V. Falgui III" Date: Mon, 6 Aug 2018 20:53:17 +0800 Subject: [PATCH 07/19] Switched incorrect cli keywords --- docs/Keybindings.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Keybindings.md b/docs/Keybindings.md index e224bcbee..a93a3eda9 100644 --- a/docs/Keybindings.md +++ b/docs/Keybindings.md @@ -12,8 +12,8 @@ c: commit changes shift+S: stash files o: open (osx only) - s: open in sublime (requires 'code' command) - v: open in vscode (requires 'subl' command) + s: open in sublime (requires 'subl' command) + v: open in vscode (requires 'code' command) i: add to .gitignore d: delete if untracked checkout if tracked (aka go away) shift+R: refresh files From 7e5d7bfe38548891aa014f3fe3ce1c0b501b20f8 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 6 Aug 2018 23:53:28 +1000 Subject: [PATCH 08/19] fix windows bash conditional error --- gitcommands.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gitcommands.go b/gitcommands.go index eabf23482..bf1a90026 100644 --- a/gitcommands.go +++ b/gitcommands.go @@ -178,10 +178,11 @@ func getGitBranches() []Branch { if branchCheck == "" { return append(branches, branchFromLine("master", 0)) } - rawString, _ := runDirectCommand(getBranchesCommand) - branchLines := splitLines(rawString) - for i, line := range branchLines { - branches = append(branches, branchFromLine(line, i)) + if rawString, err := runDirectCommand(getBranchesCommand); err == nil { + branchLines := splitLines(rawString) + for i, line := range branchLines { + branches = append(branches, branchFromLine(line, i)) + } } branches = getAndMergeFetchedBranches(branches) return branches From 91ecf1e499370469e4a5c587cdbc0b2d60d9ca2e Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Tue, 7 Aug 2018 00:07:42 +1000 Subject: [PATCH 09/19] Update README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index a2567a8d5..8c7bdf7dd 100644 --- a/README.md +++ b/README.md @@ -45,5 +45,15 @@ sudo apt-get install lazygit ## Docs [Keybindings](https://github.com/jesseduffield/lazygit/blob/master/docs/Keybindings.md) +## Milestones +[ ] Easy Installation (homebrew, release binaries) +[ ] Configurable Keybindings +[ ] Configurable Color Themes +[ ] Spawning Subprocesses (help needed - have a look at https://github.com/jesseduffield/lazygit/pull/18) +[ ] i18n + +## Contributing +I'll find a good template for contributing and then add it to the repo (or if somebody has a suggestion please put up a PR) + ## Work in progress This is still a work in progress so there's still bugs to iron out and as this is my first project in Go the code could no doubt use an increase in quality, but I'll be improving on it whenever I find the time. If you have any feedback feel free to [raise an issue](https://github.com/jesseduffield/lazygit/issues)/[submit a PR](https://github.com/jesseduffield/lazygit/pulls). From 9e5c04d57d4516f027543ba25f3698411cc99a70 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Tue, 7 Aug 2018 00:08:54 +1000 Subject: [PATCH 10/19] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8c7bdf7dd..28836bb9f 100644 --- a/README.md +++ b/README.md @@ -46,11 +46,11 @@ sudo apt-get install lazygit [Keybindings](https://github.com/jesseduffield/lazygit/blob/master/docs/Keybindings.md) ## Milestones -[ ] Easy Installation (homebrew, release binaries) -[ ] Configurable Keybindings -[ ] Configurable Color Themes -[ ] Spawning Subprocesses (help needed - have a look at https://github.com/jesseduffield/lazygit/pull/18) -[ ] i18n +- [ ] Easy Installation (homebrew, release binaries) +- [ ] Configurable Keybindings +- [ ] Configurable Color Themes +- [ ] Spawning Subprocesses (help needed - have a look at https://github.com/jesseduffield/lazygit/pull/18) +- [ ] i18n ## Contributing I'll find a good template for contributing and then add it to the repo (or if somebody has a suggestion please put up a PR) From 694b192b7452c98aafa523ab7ba4dc8f5abecdd2 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Tue, 7 Aug 2018 00:41:59 +1000 Subject: [PATCH 11/19] fix incorrect checked out branch display --- gitcommands.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gitcommands.go b/gitcommands.go index bf1a90026..80bbef860 100644 --- a/gitcommands.go +++ b/gitcommands.go @@ -183,6 +183,9 @@ func getGitBranches() []Branch { for i, line := range branchLines { branches = append(branches, branchFromLine(line, i)) } + } else { + // TODO: DRY this up + branches = append(branches, branchFromLine(gitCurrentBranchName(), 0)) } branches = getAndMergeFetchedBranches(branches) return branches @@ -525,7 +528,7 @@ func gitCurrentBranchName() string { if err != nil { return "" } - return branchName + return strings.TrimSpace(branchName) } const getBranchesCommand = `set -e From 7dc4878e0b6336f3d0cad1361cd00349fbf84316 Mon Sep 17 00:00:00 2001 From: Kevin Jullien <2154296+jukefr@users.noreply.github.com> Date: Mon, 6 Aug 2018 17:18:03 +0200 Subject: [PATCH 12/19] add p (pull) and P (push) --- docs/Keybindings.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/Keybindings.md b/docs/Keybindings.md index a93a3eda9..05039e455 100644 --- a/docs/Keybindings.md +++ b/docs/Keybindings.md @@ -5,6 +5,8 @@ ← → ↑ ↓: navigate PgUp/PgDn: scroll diff panel (use fn+up/down on osx) q: quit + p: pull + P: push ## Files Panel: From 16e3d5f09277c8a556482fa309f3ed6d67d04293 Mon Sep 17 00:00:00 2001 From: Karl Mutch Date: Mon, 6 Aug 2018 13:30:21 -0700 Subject: [PATCH 13/19] Modified reference to HEAD in one case, others appear to exist for ranges but I am not familiar enough with these. --- gitcommands.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitcommands.go b/gitcommands.go index 80bbef860..1a151310f 100644 --- a/gitcommands.go +++ b/gitcommands.go @@ -471,7 +471,7 @@ func gitPush() (string, error) { } func gitSquashPreviousTwoCommits(message string) (string, error) { - return runDirectCommand("git reset --soft head^ && git commit --amend -m \"" + message + "\"") + return runDirectCommand("git reset --soft HEAD^ && git commit --amend -m \"" + message + "\"") } func gitRenameCommit(message string) (string, error) { From c6ab9357791bf5abb4a7a4f1b552eb850b6e36ee Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Tue, 7 Aug 2018 08:27:08 +1000 Subject: [PATCH 14/19] make push keybinding more explicit --- docs/Keybindings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Keybindings.md b/docs/Keybindings.md index 05039e455..4e26aa9b5 100644 --- a/docs/Keybindings.md +++ b/docs/Keybindings.md @@ -6,7 +6,7 @@ PgUp/PgDn: scroll diff panel (use fn+up/down on osx) q: quit p: pull - P: push + shift+P: push ## Files Panel: From 90e488d5a442b4e2b5b914e38e6d1ce0d6808580 Mon Sep 17 00:00:00 2001 From: Malcolm Robinson <34327237+robthr@users.noreply.github.com> Date: Tue, 7 Aug 2018 09:34:45 +1000 Subject: [PATCH 15/19] Added macOS installation note (from #43) --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 28836bb9f..85e9d3e5b 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,10 @@ Then just call `lazygit` in your terminal inside a git repository. If you want, you can also add an alias for this with `echo "alias lg='lazygit'" >> ~/.zshrc` (or whichever rc file you're using). +Please note: +On MacOS you may have to add `~/go/bin` to your $PATH variable. + + ### Ubuntu Packages for Ubuntu 14.04 and up are available via Launchpad PPA. From 7fb77418ccbc3dfdf824537daca0adce56d73c29 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Tue, 7 Aug 2018 09:54:07 +1000 Subject: [PATCH 16/19] refactor keybindings --- gui.go | 188 ++++++++++++++++++--------------------------------------- 1 file changed, 60 insertions(+), 128 deletions(-) diff --git a/gui.go b/gui.go index 2e8672528..4d883cae5 100644 --- a/gui.go +++ b/gui.go @@ -70,135 +70,67 @@ func handleRefresh(g *gocui.Gui, v *gocui.View) error { return refreshSidePanels(g) } -func keybindings(g *gocui.Gui) error { - if err := g.SetKeybinding("", gocui.KeyArrowRight, gocui.ModNone, nextView); err != nil { - return err - } - if err := g.SetKeybinding("", gocui.KeyTab, gocui.ModNone, nextView); err != nil { - return err - } - if err := g.SetKeybinding("", gocui.KeyArrowLeft, gocui.ModNone, previousView); err != nil { - return err - } - if err := g.SetKeybinding("", 'q', gocui.ModNone, quit); err != nil { - return err - } - if err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit); err != nil { - return err - } - if err := g.SetKeybinding("", gocui.KeyArrowDown, gocui.ModNone, cursorDown); err != nil { - return err - } - if err := g.SetKeybinding("", gocui.KeyArrowUp, gocui.ModNone, cursorUp); err != nil { - return err - } - if err := g.SetKeybinding("", gocui.KeyPgup, gocui.ModNone, scrollUpMain); err != nil { - return err - } - if err := g.SetKeybinding("", gocui.KeyPgdn, gocui.ModNone, scrollDownMain); err != nil { - return err - } - if err := g.SetKeybinding("", 'P', gocui.ModNone, pushFiles); err != nil { - return err - } - if err := g.SetKeybinding("", 'p', gocui.ModNone, pullFiles); err != nil { - return err - } - if err := g.SetKeybinding("", 'R', gocui.ModNone, handleRefresh); err != nil { - return err - } - if err := g.SetKeybinding("files", 'c', gocui.ModNone, handleCommitPress); err != nil { - return err - } - if err := g.SetKeybinding("files", gocui.KeySpace, gocui.ModNone, handleFilePress); err != nil { - return err - } - if err := g.SetKeybinding("files", 'd', gocui.ModNone, handleFileRemove); err != nil { - return err - } - if err := g.SetKeybinding("files", 'm', gocui.ModNone, handleSwitchToMerge); err != nil { - return err - } - if err := g.SetKeybinding("files", 'o', gocui.ModNone, handleFileOpen); err != nil { - return err - } - if err := g.SetKeybinding("files", 's', gocui.ModNone, handleSublimeFileOpen); err != nil { - return err - } - if err := g.SetKeybinding("files", 'v', gocui.ModNone, handleVsCodeFileOpen); err != nil { - return err - } - if err := g.SetKeybinding("files", 'i', gocui.ModNone, handleIgnoreFile); err != nil { - return err - } - if err := g.SetKeybinding("files", 'r', gocui.ModNone, handleRefreshFiles); err != nil { - return err - } - if err := g.SetKeybinding("files", 'S', gocui.ModNone, handleStashSave); err != nil { - return err - } - if err := g.SetKeybinding("files", 'a', gocui.ModNone, handleAbortMerge); err != nil { - return err - } - if err := g.SetKeybinding("main", gocui.KeyArrowUp, gocui.ModNone, handleSelectTop); err != nil { - return err - } - if err := g.SetKeybinding("main", gocui.KeyEsc, gocui.ModNone, handleEscapeMerge); err != nil { - return err - } - if err := g.SetKeybinding("main", gocui.KeyArrowDown, gocui.ModNone, handleSelectBottom); err != nil { - return err - } - if err := g.SetKeybinding("main", gocui.KeySpace, gocui.ModNone, handlePickHunk); err != nil { - return err - } - if err := g.SetKeybinding("main", 'b', gocui.ModNone, handlePickBothHunks); err != nil { - return err - } - if err := g.SetKeybinding("main", gocui.KeyArrowLeft, gocui.ModNone, handleSelectPrevConflict); err != nil { - return err - } - if err := g.SetKeybinding("main", gocui.KeyArrowRight, gocui.ModNone, handleSelectNextConflict); err != nil { - return err - } - if err := g.SetKeybinding("main", 'z', gocui.ModNone, handlePopFileSnapshot); err != nil { - return err - } - if err := g.SetKeybinding("branches", gocui.KeySpace, gocui.ModNone, handleBranchPress); err != nil { - return err - } - if err := g.SetKeybinding("branches", 'c', gocui.ModNone, handleCheckoutByName); err != nil { - return err - } - if err := g.SetKeybinding("branches", 'F', gocui.ModNone, handleForceCheckout); err != nil { - return err - } - if err := g.SetKeybinding("branches", 'n', gocui.ModNone, handleNewBranch); err != nil { - return err - } - if err := g.SetKeybinding("branches", 'm', gocui.ModNone, handleMerge); err != nil { - return err - } - if err := g.SetKeybinding("commits", 's', gocui.ModNone, handleCommitSquashDown); err != nil { - return err - } - if err := g.SetKeybinding("commits", 'r', gocui.ModNone, handleRenameCommit); err != nil { - return err - } - if err := g.SetKeybinding("commits", 'g', gocui.ModNone, handleResetToCommit); err != nil { - return err - } - if err := g.SetKeybinding("stash", gocui.KeySpace, gocui.ModNone, handleStashApply); err != nil { - return err - } - // TODO: come up with a better keybinding (p/P used for pushing/pulling which - // I'd like to be global. Perhaps all global keybindings should use a modifier - // like command? But then there's gonna be hotkey conflicts with the terminal - if err := g.SetKeybinding("stash", 'k', gocui.ModNone, handleStashPop); err != nil { - return err - } +// Binding - a keybinding mapping a key and modifier to a handler. The keypress +// is only handled if the given view has focus, or handled globally if the view +// is "" +type Binding struct { + ViewName string + Handler func(*gocui.Gui, *gocui.View) error + Key interface{} // FIXME: find out how to get `gocui.Key | rune` + Modifier gocui.Modifier +} - return g.SetKeybinding("stash", 'd', gocui.ModNone, handleStashDrop) +func keybindings(g *gocui.Gui) error { + bindings := []Binding{ + Binding{ViewName: "", Key: gocui.KeyArrowLeft, Modifier: gocui.ModNone, Handler: previousView}, + Binding{ViewName: "", Key: gocui.KeyArrowRight, Modifier: gocui.ModNone, Handler: nextView}, + Binding{ViewName: "", Key: gocui.KeyTab, Modifier: gocui.ModNone, Handler: nextView}, + Binding{ViewName: "", Key: 'q', Modifier: gocui.ModNone, Handler: quit}, + Binding{ViewName: "", Key: gocui.KeyCtrlC, Modifier: gocui.ModNone, Handler: quit}, + Binding{ViewName: "", Key: gocui.KeyArrowDown, Modifier: gocui.ModNone, Handler: cursorDown}, + Binding{ViewName: "", Key: gocui.KeyArrowUp, Modifier: gocui.ModNone, Handler: cursorUp}, + Binding{ViewName: "", Key: gocui.KeyPgup, Modifier: gocui.ModNone, Handler: scrollUpMain}, + Binding{ViewName: "", Key: gocui.KeyPgdn, Modifier: gocui.ModNone, Handler: scrollDownMain}, + Binding{ViewName: "", Key: 'P', Modifier: gocui.ModNone, Handler: pushFiles}, + Binding{ViewName: "", Key: 'p', Modifier: gocui.ModNone, Handler: pullFiles}, + Binding{ViewName: "", Key: 'R', Modifier: gocui.ModNone, Handler: handleRefresh}, + Binding{ViewName: "files", Key: 'c', Modifier: gocui.ModNone, Handler: handleCommitPress}, + Binding{ViewName: "files", Key: gocui.KeySpace, Modifier: gocui.ModNone, Handler: handleFilePress}, + Binding{ViewName: "files", Key: 'd', Modifier: gocui.ModNone, Handler: handleFileRemove}, + Binding{ViewName: "files", Key: 'm', Modifier: gocui.ModNone, Handler: handleSwitchToMerge}, + Binding{ViewName: "files", Key: 'o', Modifier: gocui.ModNone, Handler: handleFileOpen}, + Binding{ViewName: "files", Key: 's', Modifier: gocui.ModNone, Handler: handleSublimeFileOpen}, + Binding{ViewName: "files", Key: 'v', Modifier: gocui.ModNone, Handler: handleVsCodeFileOpen}, + Binding{ViewName: "files", Key: 'i', Modifier: gocui.ModNone, Handler: handleIgnoreFile}, + Binding{ViewName: "files", Key: 'r', Modifier: gocui.ModNone, Handler: handleRefreshFiles}, + Binding{ViewName: "files", Key: 'S', Modifier: gocui.ModNone, Handler: handleStashSave}, + Binding{ViewName: "files", Key: 'a', Modifier: gocui.ModNone, Handler: handleAbortMerge}, + Binding{ViewName: "main", Key: gocui.KeyArrowUp, Modifier: gocui.ModNone, Handler: handleSelectTop}, + Binding{ViewName: "main", Key: gocui.KeyArrowDown, Modifier: gocui.ModNone, Handler: handleSelectBottom}, + Binding{ViewName: "main", Key: gocui.KeyEsc, Modifier: gocui.ModNone, Handler: handleEscapeMerge}, + Binding{ViewName: "main", Key: gocui.KeySpace, Modifier: gocui.ModNone, Handler: handlePickHunk}, + Binding{ViewName: "main", Key: 'b', Modifier: gocui.ModNone, Handler: handlePickBothHunks}, + Binding{ViewName: "main", Key: gocui.KeyArrowLeft, Modifier: gocui.ModNone, Handler: handleSelectPrevConflict}, + Binding{ViewName: "main", Key: gocui.KeyArrowRight, Modifier: gocui.ModNone, Handler: handleSelectNextConflict}, + Binding{ViewName: "main", Key: 'z', Modifier: gocui.ModNone, Handler: handlePopFileSnapshot}, + Binding{ViewName: "branches", Key: gocui.KeySpace, Modifier: gocui.ModNone, Handler: handleBranchPress}, + Binding{ViewName: "branches", Key: 'c', Modifier: gocui.ModNone, Handler: handleCheckoutByName}, + Binding{ViewName: "branches", Key: 'F', Modifier: gocui.ModNone, Handler: handleForceCheckout}, + Binding{ViewName: "branches", Key: 'n', Modifier: gocui.ModNone, Handler: handleNewBranch}, + Binding{ViewName: "branches", Key: 'm', Modifier: gocui.ModNone, Handler: handleMerge}, + Binding{ViewName: "commits", Key: 's', Modifier: gocui.ModNone, Handler: handleCommitSquashDown}, + Binding{ViewName: "commits", Key: 'r', Modifier: gocui.ModNone, Handler: handleRenameCommit}, + Binding{ViewName: "commits", Key: 'g', Modifier: gocui.ModNone, Handler: handleResetToCommit}, + Binding{ViewName: "stash", Key: gocui.KeySpace, Modifier: gocui.ModNone, Handler: handleStashApply}, + Binding{ViewName: "stash", Key: 'k', Modifier: gocui.ModNone, Handler: handleStashPop}, + Binding{ViewName: "stash", Key: 'd', Modifier: gocui.ModNone, Handler: handleStashDrop}, + } + for _, binding := range bindings { + if err := g.SetKeybinding(binding.ViewName, binding.Key, binding.Modifier, binding.Handler); err != nil { + return err + } + } + return nil } func layout(g *gocui.Gui) error { From f11edda6a286565755d9a03f478505773aa74232 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Tue, 7 Aug 2018 10:09:29 +1000 Subject: [PATCH 17/19] limit commits in graph output for performance --- gitcommands.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitcommands.go b/gitcommands.go index 1a151310f..71e737a6e 100644 --- a/gitcommands.go +++ b/gitcommands.go @@ -332,7 +332,7 @@ func sublimeOpenFile(filename string) (string, error) { } func getBranchGraph(branch string, baseBranch string) (string, error) { - return runCommand("git log --graph --color --abbrev-commit --decorate --date=relative --pretty=medium " + branch) + return runCommand("git log --graph --color --abbrev-commit --decorate --date=relative --pretty=medium -100 " + branch) // Leaving this guy commented out in case there's backlash from the design // change and I want to make this configurable From 236eabb8116b453ae8d3ef10dc8286b49210fe16 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Tue, 7 Aug 2018 10:39:49 +1000 Subject: [PATCH 18/19] support Updated upstream message in merge panel --- merge_panel.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/merge_panel.go b/merge_panel.go index 7b595b393..e7681993c 100644 --- a/merge_panel.go +++ b/merge_panel.go @@ -18,7 +18,7 @@ func findConflicts(content string) ([]conflict, error) { conflicts := make([]conflict, 0) var newConflict conflict for i, line := range splitLines(content) { - if line == "<<<<<<< HEAD" { + if line == "<<<<<<< HEAD" || line == "<<<<<<< Updated upstream" { newConflict = conflict{start: i} } else if line == "=======" { newConflict.middle = i From ba9485ae57a47b68e1e315fe56bd6d2755e18a4d Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Tue, 7 Aug 2018 10:41:14 +1000 Subject: [PATCH 19/19] support more merge conflict headers --- merge_panel.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/merge_panel.go b/merge_panel.go index e7681993c..54ff7c21d 100644 --- a/merge_panel.go +++ b/merge_panel.go @@ -18,7 +18,7 @@ func findConflicts(content string) ([]conflict, error) { conflicts := make([]conflict, 0) var newConflict conflict for i, line := range splitLines(content) { - if line == "<<<<<<< HEAD" || line == "<<<<<<< Updated upstream" { + if line == "<<<<<<< HEAD" || line == "<<<<<<< MERGE_HEAD" || line == "<<<<<<< Updated upstream" { newConflict = conflict{start: i} } else if line == "=======" { newConflict.middle = i