File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -516,14 +516,25 @@ private DiffHandle BuildDiffList(
516
516
ExplicitPathsOptions explicitPathsOptions ,
517
517
CompareOptions compareOptions )
518
518
{
519
- var matchedPaths = new MatchedPathsAggregator ( ) ;
520
519
var filePaths = repo . ToFilePaths ( paths ) ;
521
520
521
+ MatchedPathsAggregator matchedPaths = null ;
522
+
523
+ // We can't match paths unless we've got something to match
524
+ // against and we're told to do so.
525
+ if ( filePaths != null && explicitPathsOptions != null )
526
+ {
527
+ if ( explicitPathsOptions . OnUnmatchedPath != null || explicitPathsOptions . ShouldFailOnUnmatchedPath )
528
+ {
529
+ matchedPaths = new MatchedPathsAggregator ( ) ;
530
+ }
531
+ }
532
+
522
533
using ( GitDiffOptions options = BuildOptions ( diffOptions , filePaths , matchedPaths , compareOptions ) )
523
534
{
524
535
var diffList = comparisonHandleRetriever ( oldTreeId , newTreeId , options ) ;
525
536
526
- if ( explicitPathsOptions != null )
537
+ if ( matchedPaths != null )
527
538
{
528
539
try
529
540
{
You can’t perform that action at this time.
0 commit comments