2022-01-18 12:26:21 +02:00
|
|
|
package git_commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
gogit "github.com/jesseduffield/go-git/v5"
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/common"
|
2022-08-07 01:44:50 +02:00
|
|
|
"github.com/sasha-s/go-deadlock"
|
2022-01-18 12:26:21 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
type GitCommon struct {
|
|
|
|
*common.Common
|
2022-12-26 16:43:08 +02:00
|
|
|
version *GitVersion
|
2022-01-18 12:26:21 +02:00
|
|
|
cmd oscommands.ICmdObjBuilder
|
|
|
|
os *oscommands.OSCommand
|
|
|
|
dotGitDir string
|
|
|
|
repo *gogit.Repository
|
|
|
|
config *ConfigCommands
|
2022-01-16 05:46:53 +02:00
|
|
|
// mutex for doing things like push/pull/fetch
|
2022-08-07 01:44:50 +02:00
|
|
|
syncMutex *deadlock.Mutex
|
2022-01-18 12:26:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewGitCommon(
|
|
|
|
cmn *common.Common,
|
2022-12-26 16:43:08 +02:00
|
|
|
version *GitVersion,
|
2022-01-18 12:26:21 +02:00
|
|
|
cmd oscommands.ICmdObjBuilder,
|
|
|
|
osCommand *oscommands.OSCommand,
|
|
|
|
dotGitDir string,
|
|
|
|
repo *gogit.Repository,
|
|
|
|
config *ConfigCommands,
|
2022-08-07 01:44:50 +02:00
|
|
|
syncMutex *deadlock.Mutex,
|
2022-01-18 12:26:21 +02:00
|
|
|
) *GitCommon {
|
|
|
|
return &GitCommon{
|
|
|
|
Common: cmn,
|
2022-12-26 16:43:08 +02:00
|
|
|
version: version,
|
2022-01-18 12:26:21 +02:00
|
|
|
cmd: cmd,
|
|
|
|
os: osCommand,
|
|
|
|
dotGitDir: dotGitDir,
|
|
|
|
repo: repo,
|
|
|
|
config: config,
|
2022-01-16 05:46:53 +02:00
|
|
|
syncMutex: syncMutex,
|
2022-01-18 12:26:21 +02:00
|
|
|
}
|
|
|
|
}
|