File tree Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Original file line number Diff line number Diff line change 1- using System . IO ;
1+ using LibGit2Sharp . Tests . TestHelpers ;
2+ using System . IO ;
23using System . Linq ;
34using System . Text ;
4- using LibGit2Sharp . Tests . TestHelpers ;
55using Xunit ;
66
77namespace LibGit2Sharp . Tests
@@ -202,6 +202,34 @@ public void ComparingBlobsWithNoSpacesIndentHeuristicOptionMakesNoDifference()
202202 }
203203 }
204204
205+ [ Fact ]
206+ public void DiffSetsTheAddedAndDeletedLinesCorrectly ( )
207+ {
208+ var path = SandboxStandardTestRepoGitDir ( ) ;
209+
210+ using ( var repo = new Repository ( path ) )
211+ {
212+ var oldContent =
213+ @"1
214+ 2
215+ 3
216+ 4" ;
217+
218+ var newContent =
219+ @"1
220+ 2
221+ 3
222+ 5" ;
223+ var oldBlob = repo . ObjectDatabase . CreateBlob ( new MemoryStream ( Encoding . UTF8 . GetBytes ( oldContent ) ) ) ;
224+ var newBlob = repo . ObjectDatabase . CreateBlob ( new MemoryStream ( Encoding . UTF8 . GetBytes ( newContent ) ) ) ;
225+
226+ ContentChanges changes = repo . Diff . Compare ( oldBlob , newBlob ) ;
227+
228+ Assert . Single ( changes . AddedLines ) ;
229+ Assert . Single ( changes . DeletedLines ) ;
230+ }
231+ }
232+
205233 static string CanonicalChangedLines ( ContentChanges changes )
206234 {
207235 // Create an ordered representation of lines that have been added or removed
You can’t perform that action at this time.
0 commit comments