Create the custom-patch temp dir under lazygit's configured temp dir

Use osCommand.GetTempDir() (lazygit's own per-session temp dir, which it
creates and cleans up) as the parent for the custom-patch diff trees, instead
of the OS default — so it honors the configured temp dir and is cleaned up with
the rest of lazygit's temp files.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Haller 2026-06-24 17:20:19 +02:00
parent c3d6b39aeb
commit 49df8caf82

View file

@ -139,7 +139,7 @@ func NewGitCommandAux(
return workingTreeCommands.ShowFileDiff(from, to, reverse, filename, previousPath, plain)
},
func() (string, error) {
return os.MkdirTemp("", "lazygit-custom-patch-")
return os.MkdirTemp(osCommand.GetTempDir(), "custom-patch-")
})
patchCommands := git_commands.NewPatchCommands(gitCommon, rebaseCommands, commitCommands, statusCommands, stashCommands, patchBuilder)
bisectCommands := git_commands.NewBisectCommands(gitCommon)