@@ -87,7 +87,7 @@ public void CanEnumerateCommitsFromSha()
87
87
int count = 0 ;
88
88
using ( var repo = new Repository ( BareTestRepoPath ) )
89
89
{
90
- foreach ( Commit commit in repo . Commits . QueryBy ( new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f" } ) )
90
+ foreach ( Commit commit in repo . Commits . QueryBy ( new CommitFilter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f" } ) )
91
91
{
92
92
Assert . NotNull ( commit ) ;
93
93
count ++ ;
@@ -101,9 +101,9 @@ public void QueryingTheCommitHistoryWithUnknownShaOrInvalidEntryPointThrows()
101
101
{
102
102
using ( var repo = new Repository ( BareTestRepoPath ) )
103
103
{
104
- Assert . Throws < LibGit2SharpException > ( ( ) => repo . Commits . QueryBy ( new Filter { Since = Constants . UnknownSha } ) . Count ( ) ) ;
105
- Assert . Throws < LibGit2SharpException > ( ( ) => repo . Commits . QueryBy ( new Filter { Since = "refs/heads/deadbeef" } ) . Count ( ) ) ;
106
- Assert . Throws < ArgumentNullException > ( ( ) => repo . Commits . QueryBy ( new Filter { Since = null } ) . Count ( ) ) ;
104
+ Assert . Throws < LibGit2SharpException > ( ( ) => repo . Commits . QueryBy ( new CommitFilter { Since = Constants . UnknownSha } ) . Count ( ) ) ;
105
+ Assert . Throws < LibGit2SharpException > ( ( ) => repo . Commits . QueryBy ( new CommitFilter { Since = "refs/heads/deadbeef" } ) . Count ( ) ) ;
106
+ Assert . Throws < ArgumentNullException > ( ( ) => repo . Commits . QueryBy ( new CommitFilter { Since = null } ) . Count ( ) ) ;
107
107
}
108
108
}
109
109
@@ -115,8 +115,8 @@ public void QueryingTheCommitHistoryFromACorruptedReferenceThrows()
115
115
{
116
116
CreateCorruptedDeadBeefHead ( repo . Info . Path ) ;
117
117
118
- Assert . Throws < LibGit2SharpException > ( ( ) => repo . Commits . QueryBy ( new Filter { Since = repo . Branches [ "deadbeef" ] } ) . Count ( ) ) ;
119
- Assert . Throws < LibGit2SharpException > ( ( ) => repo . Commits . QueryBy ( new Filter { Since = repo . Refs [ "refs/heads/deadbeef" ] } ) . Count ( ) ) ;
118
+ Assert . Throws < LibGit2SharpException > ( ( ) => repo . Commits . QueryBy ( new CommitFilter { Since = repo . Branches [ "deadbeef" ] } ) . Count ( ) ) ;
119
+ Assert . Throws < LibGit2SharpException > ( ( ) => repo . Commits . QueryBy ( new CommitFilter { Since = repo . Refs [ "refs/heads/deadbeef" ] } ) . Count ( ) ) ;
120
120
}
121
121
}
122
122
@@ -125,9 +125,9 @@ public void QueryingTheCommitHistoryWithBadParamsThrows()
125
125
{
126
126
using ( var repo = new Repository ( BareTestRepoPath ) )
127
127
{
128
- Assert . Throws < ArgumentException > ( ( ) => repo . Commits . QueryBy ( new Filter { Since = string . Empty } ) ) ;
129
- Assert . Throws < ArgumentNullException > ( ( ) => repo . Commits . QueryBy ( new Filter { Since = null } ) ) ;
130
- Assert . Throws < ArgumentNullException > ( ( ) => repo . Commits . QueryBy ( null ) ) ;
128
+ Assert . Throws < ArgumentException > ( ( ) => repo . Commits . QueryBy ( new CommitFilter { Since = string . Empty } ) ) ;
129
+ Assert . Throws < ArgumentNullException > ( ( ) => repo . Commits . QueryBy ( new CommitFilter { Since = null } ) ) ;
130
+ Assert . Throws < ArgumentNullException > ( ( ) => repo . Commits . QueryBy ( default ( CommitFilter ) ) ) ;
131
131
}
132
132
}
133
133
@@ -140,7 +140,7 @@ public void CanEnumerateCommitsWithReverseTimeSorting()
140
140
int count = 0 ;
141
141
using ( var repo = new Repository ( BareTestRepoPath ) )
142
142
{
143
- foreach ( Commit commit in repo . Commits . QueryBy ( new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f" , SortBy = GitSortOptions . Time | GitSortOptions . Reverse } ) )
143
+ foreach ( Commit commit in repo . Commits . QueryBy ( new CommitFilter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f" , SortBy = GitSortOptions . Time | GitSortOptions . Reverse } ) )
144
144
{
145
145
Assert . NotNull ( commit ) ;
146
146
Assert . True ( commit . Sha . StartsWith ( reversedShas [ count ] ) ) ;
@@ -155,7 +155,7 @@ public void CanEnumerateCommitsWithReverseTopoSorting()
155
155
{
156
156
using ( var repo = new Repository ( BareTestRepoPath ) )
157
157
{
158
- List < Commit > commits = repo . Commits . QueryBy ( new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f" , SortBy = GitSortOptions . Time | GitSortOptions . Reverse } ) . ToList ( ) ;
158
+ List < Commit > commits = repo . Commits . QueryBy ( new CommitFilter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f" , SortBy = GitSortOptions . Time | GitSortOptions . Reverse } ) . ToList ( ) ;
159
159
foreach ( Commit commit in commits )
160
160
{
161
161
Assert . NotNull ( commit ) ;
@@ -183,7 +183,7 @@ public void CanEnumerateCommitsWithTimeSorting()
183
183
int count = 0 ;
184
184
using ( var repo = new Repository ( BareTestRepoPath ) )
185
185
{
186
- foreach ( Commit commit in repo . Commits . QueryBy ( new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f" , SortBy = GitSortOptions . Time } ) )
186
+ foreach ( Commit commit in repo . Commits . QueryBy ( new CommitFilter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f" , SortBy = GitSortOptions . Time } ) )
187
187
{
188
188
Assert . NotNull ( commit ) ;
189
189
Assert . True ( commit . Sha . StartsWith ( expectedShas [ count ] ) ) ;
@@ -198,7 +198,7 @@ public void CanEnumerateCommitsWithTopoSorting()
198
198
{
199
199
using ( var repo = new Repository ( BareTestRepoPath ) )
200
200
{
201
- List < Commit > commits = repo . Commits . QueryBy ( new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f" , SortBy = GitSortOptions . Topological } ) . ToList ( ) ;
201
+ List < Commit > commits = repo . Commits . QueryBy ( new CommitFilter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f" , SortBy = GitSortOptions . Topological } ) . ToList ( ) ;
202
202
foreach ( Commit commit in commits )
203
203
{
204
204
Assert . NotNull ( commit ) ;
@@ -215,7 +215,7 @@ public void CanEnumerateCommitsWithTopoSorting()
215
215
public void CanEnumerateFromHead ( )
216
216
{
217
217
AssertEnumerationOfCommits (
218
- repo => new Filter { Since = repo . Head } ,
218
+ repo => new CommitFilter { Since = repo . Head } ,
219
219
new [ ]
220
220
{
221
221
"4c062a6" , "be3563a" , "c47800c" , "9fd738e" ,
@@ -237,7 +237,7 @@ public void CanEnumerateFromDetachedHead()
237
237
repoClone . Checkout ( headSha ) ;
238
238
239
239
AssertEnumerationOfCommitsInRepo ( repoClone ,
240
- repo => new Filter { Since = repo . Head } ,
240
+ repo => new CommitFilter { Since = repo . Head } ,
241
241
new [ ]
242
242
{
243
243
"32eab9c" , "592d3c8" , "4c062a6" ,
@@ -251,7 +251,7 @@ public void CanEnumerateFromDetachedHead()
251
251
public void CanEnumerateUsingTwoHeadsAsBoundaries ( )
252
252
{
253
253
AssertEnumerationOfCommits (
254
- repo => new Filter { Since = "HEAD" , Until = "refs/heads/br2" } ,
254
+ repo => new CommitFilter { Since = "HEAD" , Until = "refs/heads/br2" } ,
255
255
new [ ] { "4c062a6" , "be3563a" }
256
256
) ;
257
257
}
@@ -260,7 +260,7 @@ public void CanEnumerateUsingTwoHeadsAsBoundaries()
260
260
public void CanEnumerateUsingImplicitHeadAsSinceBoundary ( )
261
261
{
262
262
AssertEnumerationOfCommits (
263
- repo => new Filter { Until = "refs/heads/br2" } ,
263
+ repo => new CommitFilter { Until = "refs/heads/br2" } ,
264
264
new [ ] { "4c062a6" , "be3563a" }
265
265
) ;
266
266
}
@@ -269,7 +269,7 @@ public void CanEnumerateUsingImplicitHeadAsSinceBoundary()
269
269
public void CanEnumerateUsingTwoAbbreviatedShasAsBoundaries ( )
270
270
{
271
271
AssertEnumerationOfCommits (
272
- repo => new Filter { Since = "a4a7dce" , Until = "4a202b3" } ,
272
+ repo => new CommitFilter { Since = "a4a7dce" , Until = "4a202b3" } ,
273
273
new [ ] { "a4a7dce" , "c47800c" , "9fd738e" }
274
274
) ;
275
275
}
@@ -278,7 +278,7 @@ public void CanEnumerateUsingTwoAbbreviatedShasAsBoundaries()
278
278
public void CanEnumerateCommitsFromTwoHeads ( )
279
279
{
280
280
AssertEnumerationOfCommits (
281
- repo => new Filter { Since = new [ ] { "refs/heads/br2" , "refs/heads/master" } } ,
281
+ repo => new CommitFilter { Since = new [ ] { "refs/heads/br2" , "refs/heads/master" } } ,
282
282
new [ ]
283
283
{
284
284
"4c062a6" , "a4a7dce" , "be3563a" , "c47800c" ,
@@ -290,7 +290,7 @@ public void CanEnumerateCommitsFromTwoHeads()
290
290
public void CanEnumerateCommitsFromMixedStartingPoints ( )
291
291
{
292
292
AssertEnumerationOfCommits (
293
- repo => new Filter { Since = new object [ ] { repo . Branches [ "br2" ] ,
293
+ repo => new CommitFilter { Since = new object [ ] { repo . Branches [ "br2" ] ,
294
294
"refs/heads/master" ,
295
295
new ObjectId ( "e90810b8df3e80c413d903f631643c716887138d" ) } } ,
296
296
new [ ]
@@ -305,7 +305,7 @@ public void CanEnumerateCommitsFromMixedStartingPoints()
305
305
public void CanEnumerateCommitsUsingGlob ( )
306
306
{
307
307
AssertEnumerationOfCommits (
308
- repo => new Filter { Since = repo . Refs . FromGlob ( "refs/heads/*" ) } ,
308
+ repo => new CommitFilter { Since = repo . Refs . FromGlob ( "refs/heads/*" ) } ,
309
309
new [ ]
310
310
{
311
311
"4c062a6" , "e90810b" , "6dcf9bf" , "a4a7dce" , "be3563a" , "c47800c" , "9fd738e" , "4a202b3" , "41bc8c6" , "5001298" , "5b5b025" , "8496071"
@@ -316,7 +316,7 @@ public void CanEnumerateCommitsUsingGlob()
316
316
public void CanHideCommitsUsingGlob ( )
317
317
{
318
318
AssertEnumerationOfCommits (
319
- repo => new Filter { Since = "refs/heads/packed-test" , Until = repo . Refs . FromGlob ( "*/packed" ) } ,
319
+ repo => new CommitFilter { Since = "refs/heads/packed-test" , Until = repo . Refs . FromGlob ( "*/packed" ) } ,
320
320
new [ ]
321
321
{
322
322
"4a202b3" , "5b5b025" , "8496071"
@@ -338,7 +338,7 @@ public void CanEnumerateCommitsFromATagAnnotation()
338
338
private static void CanEnumerateCommitsFromATag ( Func < Tag , object > transformer )
339
339
{
340
340
AssertEnumerationOfCommits (
341
- repo => new Filter { Since = transformer ( repo . Tags [ "test" ] ) } ,
341
+ repo => new CommitFilter { Since = transformer ( repo . Tags [ "test" ] ) } ,
342
342
new [ ] { "e90810b" , "6dcf9bf" , }
343
343
) ;
344
344
}
@@ -347,7 +347,7 @@ private static void CanEnumerateCommitsFromATag(Func<Tag, object> transformer)
347
347
public void CanEnumerateAllCommits ( )
348
348
{
349
349
AssertEnumerationOfCommits (
350
- repo => new Filter
350
+ repo => new CommitFilter
351
351
{
352
352
Since = repo . Refs . OrderBy ( r => r . CanonicalName , StringComparer . Ordinal ) ,
353
353
} ,
@@ -364,7 +364,7 @@ public void CanEnumerateAllCommits()
364
364
public void CanEnumerateCommitsFromATagWhichPointsToABlob ( )
365
365
{
366
366
AssertEnumerationOfCommits (
367
- repo => new Filter { Since = repo . Tags [ "point_to_blob" ] } ,
367
+ repo => new CommitFilter { Since = repo . Tags [ "point_to_blob" ] } ,
368
368
new string [ ] { } ) ;
369
369
}
370
370
@@ -379,20 +379,20 @@ public void CanEnumerateCommitsFromATagWhichPointsToATree()
379
379
Tag tag = repo . ApplyTag ( "point_to_tree" , headTreeSha ) ;
380
380
381
381
AssertEnumerationOfCommitsInRepo ( repo ,
382
- r => new Filter { Since = tag } ,
382
+ r => new CommitFilter { Since = tag } ,
383
383
new string [ ] { } ) ;
384
384
}
385
385
}
386
386
387
- private static void AssertEnumerationOfCommits ( Func < Repository , Filter > filterBuilder , IEnumerable < string > abbrevIds )
387
+ private static void AssertEnumerationOfCommits ( Func < Repository , CommitFilter > filterBuilder , IEnumerable < string > abbrevIds )
388
388
{
389
389
using ( var repo = new Repository ( BareTestRepoPath ) )
390
390
{
391
391
AssertEnumerationOfCommitsInRepo ( repo , filterBuilder , abbrevIds ) ;
392
392
}
393
393
}
394
394
395
- private static void AssertEnumerationOfCommitsInRepo ( Repository repo , Func < Repository , Filter > filterBuilder , IEnumerable < string > abbrevIds )
395
+ private static void AssertEnumerationOfCommitsInRepo ( Repository repo , Func < Repository , CommitFilter > filterBuilder , IEnumerable < string > abbrevIds )
396
396
{
397
397
ICommitLog commits = repo . Commits . QueryBy ( filterBuilder ( repo ) ) ;
398
398
@@ -800,7 +800,7 @@ public void CanRetrieveChildrenOfASpecificCommit()
800
800
{
801
801
const string parentSha = "5b5b025afb0b4c913b4c338a42934a3863bf3644" ;
802
802
803
- var filter = new Filter
803
+ var filter = new CommitFilter
804
804
{
805
805
/* Revwalk from all the refs (git log --all) ... */
806
806
Since = repo . Refs ,
0 commit comments