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(
516516 ExplicitPathsOptions explicitPathsOptions ,
517517 CompareOptions compareOptions )
518518 {
519- var matchedPaths = new MatchedPathsAggregator ( ) ;
520519 var filePaths = repo . ToFilePaths ( paths ) ;
521520
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+
522533 using ( GitDiffOptions options = BuildOptions ( diffOptions , filePaths , matchedPaths , compareOptions ) )
523534 {
524535 var diffList = comparisonHandleRetriever ( oldTreeId , newTreeId , options ) ;
525536
526- if ( explicitPathsOptions != null )
537+ if ( matchedPaths != null )
527538 {
528539 try
529540 {
You can’t perform that action at this time.
0 commit comments