File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -126,5 +126,44 @@ public void ComparingTwoNullBlobsReturnsAnEmptyContentChanges()
126
126
Assert . Equal ( 0 , changes . LinesDeleted ) ;
127
127
}
128
128
}
129
+
130
+ [ Fact ]
131
+ public void ComparingBlobsWithIndentHeuristicOptionMakesADifference ( )
132
+ {
133
+ var path = SandboxStandardTestRepoGitDir ( ) ;
134
+ using ( var repo = new Repository ( path ) )
135
+ {
136
+ // Based on test diff indent heuristic from:
137
+ // https://github.com/git/git/blob/433860f3d0beb0c6f205290bd16cda413148f098/t/t4061-diff-indent.sh#L17
138
+ var oldContent =
139
+ @" 1
140
+ 2
141
+ a
142
+
143
+ b
144
+ 3
145
+ 4" ;
146
+ var newContent =
147
+ @" 1
148
+ 2
149
+ a
150
+
151
+ b
152
+ a
153
+
154
+ b
155
+ 3
156
+ 4" ;
157
+ var oldBlob = repo . ObjectDatabase . CreateBlob ( new MemoryStream ( Encoding . UTF8 . GetBytes ( oldContent ) ) ) ;
158
+ var newBlob = repo . ObjectDatabase . CreateBlob ( new MemoryStream ( Encoding . UTF8 . GetBytes ( newContent ) ) ) ;
159
+ var noIndentHeuristicOption = new CompareOptions { IndentHeuristic = false } ;
160
+ var indentHeuristicOption = new CompareOptions { IndentHeuristic = true } ;
161
+
162
+ ContentChanges changes0 = repo . Diff . Compare ( oldBlob , newBlob , noIndentHeuristicOption ) ;
163
+ ContentChanges changes1 = repo . Diff . Compare ( oldBlob , newBlob , indentHeuristicOption ) ;
164
+
165
+ Assert . NotEqual ( changes0 . Patch , changes1 . Patch ) ;
166
+ }
167
+ }
129
168
}
130
169
}
You can’t perform that action at this time.
0 commit comments