@@ -213,14 +213,17 @@ public void CanStashAndPop()
213
213
var stasher = Constants . Signature ;
214
214
215
215
const string filename = "staged_file_path.txt" ;
216
- Touch ( repo . Info . WorkingDirectory , filename , "I'm staged\n " ) ;
216
+ const string contents = "I'm staged\n " ;
217
+ string contentsNew = "I'm staged" + Environment . NewLine ;
218
+ Touch ( repo . Info . WorkingDirectory , filename , contents ) ;
217
219
repo . Stage ( filename ) ;
218
220
219
221
repo . Stashes . Add ( stasher , "This stash with default options" ) ;
220
222
Assert . Equal ( StashApplyStatus . Applied , repo . Stashes . Pop ( 0 ) ) ;
221
223
222
224
Assert . Equal ( FileStatus . Untracked , repo . RetrieveStatus ( filename ) ) ;
223
225
Assert . Equal ( 0 , repo . Stashes . Count ( ) ) ;
226
+ Assert . Equal ( contentsNew , File . ReadAllText ( Path . Combine ( repo . Info . WorkingDirectory , filename ) ) ) ;
224
227
}
225
228
}
226
229
@@ -233,21 +236,25 @@ public void StashReportsConflictsWhenReinstated()
233
236
var stasher = Constants . Signature ;
234
237
235
238
const string filename = "staged_file_path.txt" ;
239
+ const string originalContents = "I'm pre-stash." ;
236
240
const string filename2 = "unstaged_file_path.txt" ;
237
- Touch ( repo . Info . WorkingDirectory , filename , "I'm staged\n " ) ;
241
+ const string newContents = "I'm post-stash." ;
242
+
243
+ Touch ( repo . Info . WorkingDirectory , filename , originalContents ) ;
238
244
repo . Stage ( filename ) ;
239
- Touch ( repo . Info . WorkingDirectory , filename2 , "I'm unstaged \n " ) ;
245
+ Touch ( repo . Info . WorkingDirectory , filename2 , originalContents ) ;
240
246
241
247
repo . Stashes . Add ( stasher , "This stash with default options" ) ;
242
248
243
- Touch ( repo . Info . WorkingDirectory , filename , "I'm another staged \n " ) ;
249
+ Touch ( repo . Info . WorkingDirectory , filename , newContents ) ;
244
250
repo . Stage ( filename ) ;
245
- Touch ( repo . Info . WorkingDirectory , filename2 , "I'm unstaged another staged \n " ) ;
251
+ Touch ( repo . Info . WorkingDirectory , filename2 , newContents ) ;
246
252
247
253
Assert . Equal ( StashApplyStatus . Conflicts , repo . Stashes . Pop ( 0 , StashApplyModifiers . ReinstateIndex ) ) ;
254
+ Assert . Equal ( 1 , repo . Stashes . Count ( ) ) ;
255
+ Assert . Equal ( originalContents , File . ReadAllText ( Path . Combine ( repo . Info . WorkingDirectory , filename ) ) ) ;
256
+ Assert . Equal ( originalContents , File . ReadAllText ( Path . Combine ( repo . Info . WorkingDirectory , filename2 ) ) ) ;
248
257
249
- // TODO: Find out why repo.Index.Conflicts doesn't have any data.
250
- Assert . NotNull ( repo . Index . Conflicts [ filename ] ) ;
251
258
}
252
259
}
253
260
0 commit comments