File tree 1 file changed +30
-2
lines changed
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 ;
2
3
using System . Linq ;
3
4
using System . Text ;
4
- using LibGit2Sharp . Tests . TestHelpers ;
5
5
using Xunit ;
6
6
7
7
namespace LibGit2Sharp . Tests
@@ -202,6 +202,34 @@ public void ComparingBlobsWithNoSpacesIndentHeuristicOptionMakesNoDifference()
202
202
}
203
203
}
204
204
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
+
205
233
static string CanonicalChangedLines ( ContentChanges changes )
206
234
{
207
235
// Create an ordered representation of lines that have been added or removed
You can’t perform that action at this time.
0 commit comments