[
https://issues.apache.org/jira/browse/SCM-925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17568687#comment-17568687
]
ASF GitHub Bot commented on SCM-925:
------------------------------------
michael-o commented on code in PR #144:
URL: https://github.com/apache/maven-scm/pull/144#discussion_r924857373
##########
maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/JGitUtils.java:
##########
@@ -461,5 +462,60 @@ public RevFilter clone()
return revs;
}
}
+
+ /**
+ * Remove all files in the given fileSet to the repository.
+ *
+ * @param git the repo to remove the files from
+ * @param fileSet the set of files within the workspace, the files are
removed
+ * relative to the basedir of this fileset
+ * @return a list of removed files
+ * @throws GitAPIException
+ * @throws NoFilepatternException
+ */
+ public static List<ScmFile> removeAllFiles( Git git, ScmFileSet fileSet )
+ throws GitAPIException, NoFilepatternException
+ {
+ URI baseUri = fileSet.getBasedir().toURI();
+ RmCommand remove = git.rm();
+ for ( File file : fileSet.getFileList() )
+ {
+ if ( !file.isAbsolute() )
+ {
+ file = new File( fileSet.getBasedir().getPath(),
file.getPath() );
+ }
+
+ if ( file.exists() )
+ {
+ String path = relativize( baseUri, file );
+ remove.addFilepattern( path );
+ remove.addFilepattern( file.getAbsolutePath() );
Review Comment:
@kwin Maybe you have an explanation for this...?
> RemoveCommand unsupported - maven-release-plugin:prepare-with-pom failing
> -------------------------------------------------------------------------
>
> Key: SCM-925
> URL: https://issues.apache.org/jira/browse/SCM-925
> Project: Maven SCM
> Issue Type: Bug
> Components: maven-scm-provider-jgit
> Affects Versions: 1.11.2
> Reporter: Georg Tsakumagos
> Assignee: Michael Osipov
> Priority: Major
> Fix For: 2.0.0-M2
>
> Attachments: maven-scm-provider-jgit.log
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> The git scm plugins differs in support for the scm command _remove_. This
> breaks the goal _prepare-with-pom_ of the _maven-release-plugin_ using the
> _maven-scm-provider-jgit_. The method is not fully implemented and throws an
> UnsupportedOperationException.
> Referring to the ["Maven SCM Providers
> Matrix"|https://maven.apache.org/scm/matrix.html] this feature is documented
> as supported and should be implemented in the _jgit_ provider like in
> maven-scm-provider-gitexe.
>
> ||Variant||remove supported||Source||
> |maven-scm-provider-gitexe|(/)|[Github - GitExeScmProvider.java -
> getRemoveCommand()|https://github.com/apache/maven-scm/blob/a1f7e9857076940c878a370ff599b394df768d33/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/GitExeScmProvider.java#L97]|
> |maven-scm-provider-jgit|(x)|[Github - JGitScmProvider.java -
> getRemoveCommand()|https://github.com/apache/maven-scm/blob/a1f7e9857076940c878a370ff599b394df768d33/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/JGitScmProvider.java#L113]|
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)