1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Merge branch 'master' into feature/rebasing

This commit is contained in:
Jesse Duffield
2019-02-11 22:46:27 +11:00
23 changed files with 527 additions and 43 deletions

View File

@ -5,7 +5,7 @@ package commands
import (
"bufio"
"bytes"
"errors"
"github.com/go-errors/errors"
"os"
"os/exec"
"strings"

View File

@ -1,7 +1,6 @@
package commands
import (
"errors"
"fmt"
"io/ioutil"
"os"
@ -11,6 +10,8 @@ import (
"strings"
"github.com/fatih/color"
"github.com/go-errors/errors"
"github.com/jesseduffield/lazygit/pkg/i18n"
"github.com/jesseduffield/lazygit/pkg/utils"
"github.com/sirupsen/logrus"
@ -31,11 +32,11 @@ func navigateToRepoRootDirectory(stat func(string) (os.FileInfo, error), chdir f
}
if !os.IsNotExist(err) {
return err
return errors.Wrap(err, 0)
}
if err = chdir(".."); err != nil {
return err
return errors.Wrap(err, 0)
}
}
}

View File

@ -1,13 +1,14 @@
package commands
import (
"errors"
"io/ioutil"
"os"
"os/exec"
"regexp"
"strings"
"github.com/go-errors/errors"
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/utils"
"github.com/mgutz/str"
@ -122,7 +123,7 @@ func sanitisedCommandOutput(output []byte, err error) (string, error) {
// errors like 'exit status 1' are not very useful so we'll create an error
// from the combined output
if outputString == "" {
return "", err
return "", errors.Wrap(err, 0)
}
return outputString, errors.New(outputString)
}
@ -201,12 +202,12 @@ func (c *OSCommand) Unquote(message string) string {
func (c *OSCommand) AppendLineToFile(filename, line string) error {
f, err := os.OpenFile(filename, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
if err != nil {
return err
return errors.Wrap(err, 0)
}
defer f.Close()
_, err = f.WriteString("\n" + line)
return err
return errors.Wrap(err, 0)
}
// CreateTempFile writes a string to a new temp file and returns the file's name
@ -214,16 +215,16 @@ func (c *OSCommand) CreateTempFile(filename, content string) (string, error) {
tmpfile, err := ioutil.TempFile("", filename)
if err != nil {
c.Log.Error(err)
return "", err
return "", errors.Wrap(err, 0)
}
if _, err := tmpfile.WriteString(content); err != nil {
c.Log.Error(err)
return "", err
return "", errors.Wrap(err, 0)
}
if err := tmpfile.Close(); err != nil {
c.Log.Error(err)
return "", err
return "", errors.Wrap(err, 0)
}
return tmpfile.Name(), nil
@ -231,7 +232,8 @@ func (c *OSCommand) CreateTempFile(filename, content string) (string, error) {
// RemoveFile removes a file at the specified path
func (c *OSCommand) RemoveFile(filename string) error {
return os.Remove(filename)
err := os.Remove(filename)
return errors.Wrap(err, 0)
}
// FileExists checks whether a file exists at the specified path

View File

@ -1,9 +1,10 @@
package commands
import (
"errors"
"fmt"
"strings"
"github.com/go-errors/errors"
)
// Service is a service that repository is on (Github, Bitbucket, ...)