@@ -125,8 +125,9 @@ pub(super) mod inner {
125
125
) -> Result < merge:: Command , Error > {
126
126
fn write_data (
127
127
data : & [ u8 ] ,
128
+ directory : & Path ,
128
129
) -> std:: io:: Result < ( gix_tempfile:: Handle < gix_tempfile:: handle:: Closed > , PathBuf ) > {
129
- let mut file = gix_tempfile:: new ( Path :: new ( "" ) , ContainingDirectory :: Exists , AutoRemove :: Tempfile ) ?;
130
+ let mut file = gix_tempfile:: new ( directory , ContainingDirectory :: Exists , AutoRemove :: Tempfile ) ?;
130
131
file. write_all ( data) ?;
131
132
let mut path = Default :: default ( ) ;
132
133
file. with_mut ( |f| {
@@ -146,17 +147,22 @@ pub(super) mod inner {
146
147
kind : ResourceKind :: OtherOrTheirs ,
147
148
} ) ?;
148
149
149
- let ( base_tmp, base_path) = write_data ( base) . map_err ( |err| Error :: CreateTempfile {
150
+ let tmp_dir = context
151
+ . worktree_dir
152
+ . as_deref ( )
153
+ . or ( context. git_dir . as_deref ( ) )
154
+ . unwrap_or ( Path :: new ( "" ) ) ;
155
+ let ( base_tmp, base_path) = write_data ( base, tmp_dir) . map_err ( |err| Error :: CreateTempfile {
150
156
rela_path : self . ancestor . rela_path . into ( ) ,
151
157
kind : ResourceKind :: CommonAncestorOrBase ,
152
158
source : err,
153
159
} ) ?;
154
- let ( ours_tmp, ours_path) = write_data ( ours) . map_err ( |err| Error :: CreateTempfile {
160
+ let ( ours_tmp, ours_path) = write_data ( ours, tmp_dir ) . map_err ( |err| Error :: CreateTempfile {
155
161
rela_path : self . current . rela_path . into ( ) ,
156
162
kind : ResourceKind :: CurrentOrOurs ,
157
163
source : err,
158
164
} ) ?;
159
- let ( theirs_tmp, theirs_path) = write_data ( theirs) . map_err ( |err| Error :: CreateTempfile {
165
+ let ( theirs_tmp, theirs_path) = write_data ( theirs, tmp_dir ) . map_err ( |err| Error :: CreateTempfile {
160
166
rela_path : self . other . rela_path . into ( ) ,
161
167
kind : ResourceKind :: OtherOrTheirs ,
162
168
source : err,
0 commit comments