You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "kwin (via GitHub)" <gi...@apache.org> on 2026/06/08 08:05:26 UTC

Re: [PR] JGitStatusCommand: filter results by fileSet.getFileList() if not empty [maven-scm]

kwin commented on code in PR #1370:
URL: https://github.com/apache/maven-scm/pull/1370#discussion_r3371627960


##########
maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/status/JGitStatusCommand.java:
##########
@@ -51,7 +54,11 @@ protected StatusScmResult executeStatusCommand(ScmProviderRepository repo, ScmFi
             git = JGitUtils.openRepo(fileSet.getBasedir());
             Status status = git.status().call();
             List<ScmFile> changedFiles = getFileStati(status);
-
+            if (!fileSet.getFileList().isEmpty()) {
+                Set<String> fileSetPaths =
+                        fileSet.getFileList().stream().map(File::toString).collect(Collectors.toSet());
+                changedFiles.removeIf(scmFile -> !fileSetPaths.contains(scmFile.getPath()));

Review Comment:
   The base directory of the fileSet is not necessarily the root directory of the working copy, therefore some file adjustments are necessary before comparing with `changedFiles.path`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org