mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-21 00:30:00 +02:00
Save patch files in TempDir
This commit is contained in:
committed by
Jesse Duffield
parent
c8e9d1b4fc
commit
663c036ca5
@ -224,7 +224,7 @@ func (c *GitCommand) WorktreeFileDiffCmdStr(node models.IFile, plain bool, cache
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *GitCommand) ApplyPatch(patch string, flags ...string) error {
|
func (c *GitCommand) ApplyPatch(patch string, flags ...string) error {
|
||||||
filepath := filepath.Join(c.Config.GetUserConfigDir(), utils.GetCurrentRepoName(), time.Now().Format("Jan _2 15.04.05.000000000")+".patch")
|
filepath := filepath.Join(c.Config.GetTempDir(), utils.GetCurrentRepoName(), time.Now().Format("Jan _2 15.04.05.000000000")+".patch")
|
||||||
c.Log.Infof("saving temporary patch to %s", filepath)
|
c.Log.Infof("saving temporary patch to %s", filepath)
|
||||||
if err := c.OSCommand.CreateFileWithContent(filepath, patch); err != nil {
|
if err := c.OSCommand.CreateFileWithContent(filepath, patch); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -21,6 +21,7 @@ type AppConfig struct {
|
|||||||
UserConfig *UserConfig
|
UserConfig *UserConfig
|
||||||
UserConfigDir string
|
UserConfigDir string
|
||||||
UserConfigPath string
|
UserConfigPath string
|
||||||
|
TempDir string
|
||||||
AppState *AppState
|
AppState *AppState
|
||||||
IsNewRepo bool
|
IsNewRepo bool
|
||||||
}
|
}
|
||||||
@ -37,6 +38,7 @@ type AppConfigurer interface {
|
|||||||
GetUserConfig() *UserConfig
|
GetUserConfig() *UserConfig
|
||||||
GetUserConfigDir() string
|
GetUserConfigDir() string
|
||||||
GetUserConfigPath() string
|
GetUserConfigPath() string
|
||||||
|
GetTempDir() string
|
||||||
GetAppState() *AppState
|
GetAppState() *AppState
|
||||||
SaveAppState() error
|
SaveAppState() error
|
||||||
SetIsNewRepo(bool)
|
SetIsNewRepo(bool)
|
||||||
@ -60,6 +62,8 @@ func NewAppConfig(name, version, commit, date string, buildSource string, debugg
|
|||||||
debuggingFlag = true
|
debuggingFlag = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tempDir := filepath.Join(os.TempDir(), "lazygit")
|
||||||
|
|
||||||
appState, err := loadAppState()
|
appState, err := loadAppState()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -75,6 +79,7 @@ func NewAppConfig(name, version, commit, date string, buildSource string, debugg
|
|||||||
UserConfig: userConfig,
|
UserConfig: userConfig,
|
||||||
UserConfigDir: configDir,
|
UserConfigDir: configDir,
|
||||||
UserConfigPath: filepath.Join(configDir, "config.yml"),
|
UserConfigPath: filepath.Join(configDir, "config.yml"),
|
||||||
|
TempDir: tempDir,
|
||||||
AppState: appState,
|
AppState: appState,
|
||||||
IsNewRepo: false,
|
IsNewRepo: false,
|
||||||
}
|
}
|
||||||
@ -204,6 +209,10 @@ func (c *AppConfig) GetUserConfigDir() string {
|
|||||||
return c.UserConfigDir
|
return c.UserConfigDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *AppConfig) GetTempDir() string {
|
||||||
|
return c.TempDir
|
||||||
|
}
|
||||||
|
|
||||||
func (c *AppConfig) ReloadUserConfig() error {
|
func (c *AppConfig) ReloadUserConfig() error {
|
||||||
userConfig, err := loadUserConfigWithDefaults(c.UserConfigDir)
|
userConfig, err := loadUserConfigWithDefaults(c.UserConfigDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user