@@ -200,18 +200,13 @@ impl FileState {
200
200
}
201
201
}
202
202
203
- fn for_file (
204
- executable : bool ,
205
- size : u64 ,
206
- metadata : & Metadata ,
207
- materialized_conflict_data : Option < MaterializedConflictData > ,
208
- ) -> Self {
203
+ fn for_file ( executable : bool , size : u64 , metadata : & Metadata ) -> Self {
209
204
let executable = FileExecutableFlag :: from_bool_lossy ( executable) ;
210
205
Self {
211
206
file_type : FileType :: Normal { executable } ,
212
207
mtime : mtime_from_metadata ( metadata) ,
213
208
size,
214
- materialized_conflict_data,
209
+ materialized_conflict_data : None ,
215
210
}
216
211
}
217
212
@@ -1743,12 +1738,7 @@ impl TreeState {
1743
1738
let metadata = file
1744
1739
. metadata ( )
1745
1740
. map_err ( |err| checkout_error_for_stat_error ( err, disk_path) ) ?;
1746
- Ok ( FileState :: for_file (
1747
- executable,
1748
- size as u64 ,
1749
- & metadata,
1750
- None ,
1751
- ) )
1741
+ Ok ( FileState :: for_file ( executable, size as u64 , & metadata) )
1752
1742
}
1753
1743
1754
1744
fn write_symlink ( & self , disk_path : & Path , target : String ) -> Result < FileState , CheckoutError > {
@@ -1772,7 +1762,6 @@ impl TreeState {
1772
1762
disk_path : & Path ,
1773
1763
contents : & [ u8 ] ,
1774
1764
executable : bool ,
1775
- materialized_conflict_data : Option < MaterializedConflictData > ,
1776
1765
) -> Result < FileState , CheckoutError > {
1777
1766
let contents = self
1778
1767
. target_eol_strategy
@@ -1800,12 +1789,7 @@ impl TreeState {
1800
1789
let metadata = file
1801
1790
. metadata ( )
1802
1791
. map_err ( |err| checkout_error_for_stat_error ( err, disk_path) ) ?;
1803
- Ok ( FileState :: for_file (
1804
- executable,
1805
- size,
1806
- & metadata,
1807
- materialized_conflict_data,
1808
- ) )
1792
+ Ok ( FileState :: for_file ( executable, size, & metadata) )
1809
1793
}
1810
1794
1811
1795
#[ cfg_attr( windows, allow( unused_variables) ) ]
@@ -1997,23 +1981,20 @@ impl TreeState {
1997
1981
conflict_marker_style,
1998
1982
conflict_marker_len,
1999
1983
) ;
2000
- let materialized_conflict_data = MaterializedConflictData {
1984
+ let mut file_state = self
1985
+ . write_conflict ( & disk_path, & contents, file. executable . unwrap_or ( false ) )
1986
+ . await ?;
1987
+ file_state. materialized_conflict_data = Some ( MaterializedConflictData {
2001
1988
conflict_marker_len : conflict_marker_len. try_into ( ) . unwrap_or ( u32:: MAX ) ,
2002
- } ;
2003
- self . write_conflict (
2004
- & disk_path,
2005
- & contents,
2006
- file. executable . unwrap_or ( false ) ,
2007
- Some ( materialized_conflict_data) ,
2008
- )
2009
- . await ?
1989
+ } ) ;
1990
+ file_state
2010
1991
}
2011
1992
MaterializedTreeValue :: OtherConflict { id } => {
2012
1993
// Unless all terms are regular files, we can't do much
2013
1994
// better than trying to describe the merge.
2014
1995
let contents = id. describe ( ) ;
2015
1996
let executable = false ;
2016
- self . write_conflict ( & disk_path, contents. as_bytes ( ) , executable, None )
1997
+ self . write_conflict ( & disk_path, contents. as_bytes ( ) , executable)
2017
1998
. await ?
2018
1999
}
2019
2000
} ;
0 commit comments