@@ -36,11 +36,10 @@ use termcolor::WriteColor;
36
36
37
37
use crate :: {
38
38
commit:: { CommitExtended , RepositoryCommitExtended } ,
39
- index:: TemporaryIndex ,
40
39
patchname:: PatchName ,
41
40
signature:: SignatureExtended ,
42
41
stack:: { PatchState , Stack , StackStateAccess } ,
43
- stupid:: Stupid ,
42
+ stupid:: { Stupid , StupidContext } ,
44
43
} ;
45
44
46
45
use super :: { error:: Error , state:: StackState } ;
@@ -1034,11 +1033,12 @@ impl<'repo> StackTransaction<'repo> {
1034
1033
where
1035
1034
P : AsRef < PatchName > ,
1036
1035
{
1037
- self . stack . repo . with_temp_index_file ( |temp_index| {
1036
+ let stupid = self . stack . repo . stupid ( ) ;
1037
+ stupid. with_temp_index ( |stupid_temp| {
1038
1038
let mut temp_index_tree_id: Option < git2:: Oid > = None ;
1039
1039
1040
1040
let merged = if check_merged {
1041
- Some ( self . check_merged ( patchnames, temp_index , & mut temp_index_tree_id) ?)
1041
+ Some ( self . check_merged ( patchnames, stupid_temp , & mut temp_index_tree_id) ?)
1042
1042
} else {
1043
1043
None
1044
1044
} ;
@@ -1054,10 +1054,11 @@ impl<'repo> StackTransaction<'repo> {
1054
1054
patchname,
1055
1055
already_merged,
1056
1056
is_last,
1057
- temp_index ,
1057
+ stupid_temp ,
1058
1058
& mut temp_index_tree_id,
1059
1059
) ?;
1060
1060
}
1061
+
1061
1062
Ok ( ( ) )
1062
1063
} )
1063
1064
}
@@ -1067,7 +1068,7 @@ impl<'repo> StackTransaction<'repo> {
1067
1068
patchname : & PatchName ,
1068
1069
already_merged : bool ,
1069
1070
is_last : bool ,
1070
- temp_index : & mut git2 :: Index ,
1071
+ stupid_temp : & StupidContext ,
1071
1072
temp_index_tree_id : & mut Option < git2:: Oid > ,
1072
1073
) -> Result < ( ) > {
1073
1074
let repo = self . stack . repo ;
@@ -1096,10 +1097,6 @@ impl<'repo> StackTransaction<'repo> {
1096
1097
( new_parent. tree_id ( ) , patch_commit. tree_id ( ) )
1097
1098
} ;
1098
1099
let base = old_parent. tree_id ( ) ;
1099
- // let ours = new_parent.tree_id();
1100
- // let theirs = patch_commit.tree_id();
1101
-
1102
- let stupid_temp = stupid. with_index_path ( temp_index. path ( ) . unwrap ( ) ) ;
1103
1100
1104
1101
if temp_index_tree_id != & Some ( ours) {
1105
1102
stupid_temp. read_tree ( ours) ?;
@@ -1218,20 +1215,17 @@ impl<'repo> StackTransaction<'repo> {
1218
1215
fn check_merged < ' a , P > (
1219
1216
& self ,
1220
1217
patchnames : & ' a [ P ] ,
1221
- temp_index : & mut git2 :: Index ,
1218
+ stupid_temp : & StupidContext ,
1222
1219
temp_index_tree_id : & mut Option < git2:: Oid > ,
1223
1220
) -> Result < Vec < & ' a PatchName > >
1224
1221
where
1225
1222
P : AsRef < PatchName > ,
1226
1223
{
1227
- let repo = self . stack . repo ;
1228
- let stupid = repo. stupid ( ) ;
1229
- let stupid = stupid. with_index_path ( temp_index. path ( ) . unwrap ( ) ) ;
1230
1224
let head_tree_id = self . stack . branch_head . tree_id ( ) ;
1231
1225
let mut merged: Vec < & PatchName > = vec ! [ ] ;
1232
1226
1233
1227
if temp_index_tree_id != & Some ( head_tree_id) {
1234
- stupid . read_tree ( head_tree_id) ?;
1228
+ stupid_temp . read_tree ( head_tree_id) ?;
1235
1229
* temp_index_tree_id = Some ( head_tree_id) ;
1236
1230
}
1237
1231
@@ -1245,7 +1239,9 @@ impl<'repo> StackTransaction<'repo> {
1245
1239
1246
1240
let parent_commit = patch_commit. parent ( 0 ) ?;
1247
1241
1248
- if stupid. apply_treediff_to_index ( patch_commit. tree_id ( ) , parent_commit. tree_id ( ) ) ? {
1242
+ if stupid_temp
1243
+ . apply_treediff_to_index ( patch_commit. tree_id ( ) , parent_commit. tree_id ( ) ) ?
1244
+ {
1249
1245
merged. push ( patchname) ;
1250
1246
* temp_index_tree_id = None ;
1251
1247
}
0 commit comments