Compare commits

..
6 Commits
6 changed files with 28 additions and 4 deletions
+1 -1
View File
@@ -1 +1 @@
v0.1.49
v0.1.51
+2
View File
@@ -12,6 +12,7 @@
space: toggle staged
c: commit changes
shift+C: commit using git editor
shift+S: stash files
t: add patched (i.e. pick chunks of a file to add)
o: open
@@ -47,6 +48,7 @@
esc: close/cancel
enter: confirm
tab: enter newline (if editing)
## Resolving Merge Conflicts (Diff Panel):
+8
View File
@@ -186,6 +186,14 @@ func handleCommitPress(g *gocui.Gui, filesView *gocui.View) error {
return nil
}
func handleCommitEditorPress(g *gocui.Gui, filesView *gocui.View) error {
if len(stagedFiles(state.GitFiles)) == 0 && !state.HasMergeConflicts {
return createErrorPanel(g, "There are no staged files to commit")
}
runSubProcess(g, "git", "commit")
return nil
}
func genericFileOpen(g *gocui.Gui, v *gocui.View, open func(*gocui.Gui, string) (string, error)) error {
file, err := getSelectedFile(g)
if err != nil {
+6 -1
View File
@@ -271,6 +271,11 @@ func editFile(g *gocui.Gui, filename string) (string, error) {
if editor == "" {
editor = os.Getenv("EDITOR")
}
if editor == "" {
if _, err := runCommand("which vi"); err == nil {
editor = "vi"
}
}
if editor == "" {
return "", createErrorPanel(g, "No editor defined in $VISUAL, $EDITOR, or git config.")
}
@@ -487,7 +492,7 @@ func gitNewBranch(name string) (string, error) {
}
func gitDeleteBranch(branch string) (string, error) {
return runCommand("git branch -d " + branch)
return runCommand("git branch -d " + branch)
}
func gitListStash() (string, error) {
+1
View File
@@ -22,6 +22,7 @@ func keybindings(g *gocui.Gui) error {
{ViewName: "", Key: 'p', Modifier: gocui.ModNone, Handler: pullFiles},
{ViewName: "", Key: 'R', Modifier: gocui.ModNone, Handler: handleRefresh},
{ViewName: "files", Key: 'c', Modifier: gocui.ModNone, Handler: handleCommitPress},
{ViewName: "files", Key: 'C', Modifier: gocui.ModNone, Handler: handleCommitEditorPress},
{ViewName: "files", Key: gocui.KeySpace, Modifier: gocui.ModNone, Handler: handleFilePress},
{ViewName: "files", Key: 'd', Modifier: gocui.ModNone, Handler: handleFileRemove},
{ViewName: "files", Key: 'm', Modifier: gocui.ModNone, Handler: handleSwitchToMerge},
+10 -2
View File
@@ -10,12 +10,14 @@ import (
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"strconv"
"strings"
)
func main() {
version, err := ioutil.ReadFile("VERSION")
if err != nil {
log.Panicln(err.Error())
@@ -47,9 +49,15 @@ func main() {
func runCommand(args ...string) {
fmt.Println(strings.Join(args, " "))
output, err := exec.Command(args[0], args[1:]...).CombinedOutput()
cmd := exec.Command(args[0], args[1:]...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Start()
if err != nil {
panic(err.Error())
}
err = cmd.Wait()
if err != nil {
panic(err.Error())
}
log.Print(string(output))
}