mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-10 23:57:43 +02:00
no more go-git for committing (reflecting the change in master)
This commit is contained in:
parent
e8eb78617c
commit
e6beb5d50b
@ -6,14 +6,12 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||||
gitconfig "github.com/tcnksm/go-gitconfig"
|
gitconfig "github.com/tcnksm/go-gitconfig"
|
||||||
gogit "gopkg.in/src-d/go-git.v4"
|
gogit "gopkg.in/src-d/go-git.v4"
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing/object"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// GitCommand is our main git interface
|
// GitCommand is our main git interface
|
||||||
@ -272,27 +270,13 @@ func (c *GitCommand) AbortMerge() (string, error) {
|
|||||||
|
|
||||||
// GitCommit commit to git
|
// GitCommit commit to git
|
||||||
func (c *GitCommand) GitCommit(g *gocui.Gui, message string) (string, error) {
|
func (c *GitCommand) GitCommit(g *gocui.Gui, message string) (string, error) {
|
||||||
|
command := "git commit -m \"" + message + "\""
|
||||||
gpgsign, _ := gitconfig.Global("commit.gpgsign")
|
gpgsign, _ := gitconfig.Global("commit.gpgsign")
|
||||||
if gpgsign != "" {
|
if gpgsign != "" {
|
||||||
sub, err := c.OSCommand.RunSubProcess("git", "commit")
|
sub, err := c.OSCommand.RunSubProcess("git", "commit")
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
userName, err := gitconfig.Username()
|
return c.OSCommand.RunDirectCommand(command)
|
||||||
if userName == "" {
|
|
||||||
return "", errNoUsername
|
|
||||||
}
|
|
||||||
userEmail, err := gitconfig.Email()
|
|
||||||
_, err = c.Worktree.Commit(message, &gogit.CommitOptions{
|
|
||||||
Author: &object.Signature{
|
|
||||||
Name: userName,
|
|
||||||
Email: userEmail,
|
|
||||||
When: time.Now(),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err.Error(), err
|
|
||||||
}
|
|
||||||
return "", nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GitPull pull from repo
|
// GitPull pull from repo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user