mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-06 03:53:59 +02:00
check both local and global config for gpgsign
This commit is contained in:
parent
f549ad0f37
commit
d4f4b46a1f
@ -250,15 +250,27 @@ func (c *GitCommand) AbortMerge() (string, error) {
|
|||||||
return c.OSCommand.RunDirectCommand("git merge --abort")
|
return c.OSCommand.RunDirectCommand("git merge --abort")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UsingGpg tells us whether the user has gpg enabled so that we can know
|
||||||
|
// whether we need to run a subprocess to allow them to enter their password
|
||||||
|
func (c *GitCommand) UsingGpg() bool {
|
||||||
|
gpgsign, _ := gitconfig.Global("commit.gpgsign")
|
||||||
|
if gpgsign == "" {
|
||||||
|
gpgsign, _ = gitconfig.Local("commit.gpgsign")
|
||||||
|
}
|
||||||
|
if gpgsign == "" {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// Commit commit to git
|
// Commit commit to git
|
||||||
func (c *GitCommand) Commit(g *gocui.Gui, message string) (*exec.Cmd, error) {
|
func (c *GitCommand) Commit(g *gocui.Gui, message string) (*exec.Cmd, error) {
|
||||||
command := "commit -m \"" + message + "\""
|
command := "git commit -m \"" + message + "\""
|
||||||
gpgsign, _ := gitconfig.Global("commit.gpgsign")
|
if c.UsingGpg() {
|
||||||
if gpgsign != "" {
|
return c.OSCommand.PrepareSubProcess(c.OSCommand.Platform.shell, c.OSCommand.Platform.shellArg, command)
|
||||||
return c.OSCommand.PrepareSubProcess("git", command)
|
|
||||||
}
|
}
|
||||||
// TODO: make these runDirectCommand functions just return an error
|
// TODO: make these runDirectCommand functions just return an error
|
||||||
_, err := c.OSCommand.RunDirectCommand("git " + command)
|
_, err := c.OSCommand.RunDirectCommand(command)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user