[
https://issues.apache.org/jira/browse/SCM-717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17962696#comment-17962696
]
ASF GitHub Bot commented on SCM-717:
------------------------------------
jira-importer opened a new issue, #920:
URL: https://github.com/apache/maven-scm/issues/920
**[Benjamin
Irwin](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=irwinb)**
opened
**[SCM-717](https://issues.apache.org/jira/browse/SCM-717?redirect=false)** and
commented
I ran the following maven command: mvn -DworkingDirectory=src
-Dincludes=**/* scm:add
I expected this to add all the files under a given directory (say src) to
perforce. The perforce provider finds all the files, but it tries to add them
to the "src" directory instead of adding them to the directory where the file
actually exists. E.g. suppose src/main/java/sample/Example.java exists, after I
run the command above perforce will attempt to add the file Example.java to the
src directory.
I read through the code, and I'm pretty confident I found the bug. In
org.apache.maven.scm.provider.perforce.command.add.PerforceAddCommand.createCommandLine
(line 87): this line says file.getName(), which per the java spec will return
just the file name, but not the path. I believe if this call were changed to
file.getPath(), that it would resolve the problem.
While finding this problem, I noticed that PerforceRemoveCommand:90 has
exactly the same bug.
---
**Affects:** 1.8.1
> Perforce Provider Add/Remove functions do not work correctly with ** wildcard.
> ------------------------------------------------------------------------------
>
> Key: SCM-717
> URL: https://issues.apache.org/jira/browse/SCM-717
> Project: Maven SCM (Moved to GitHub Issues)
> Issue Type: Bug
> Components: maven-scm-provider-perforce
> Affects Versions: 1.8.1
> Environment: Windows 7
> Reporter: Benjamin Irwin
> Priority: Major
>
> I ran the following maven command: mvn -DworkingDirectory=src -Dincludes=**/*
> scm:add
> I expected this to add all the files under a given directory (say src) to
> perforce. The perforce provider finds all the files, but it tries to add them
> to the "src" directory instead of adding them to the directory where the file
> actually exists. E.g. suppose src/main/java/sample/Example.java exists, after
> I run the command above perforce will attempt to add the file Example.java to
> the src directory.
> I read through the code, and I'm pretty confident I found the bug. In
> org.apache.maven.scm.provider.perforce.command.add.PerforceAddCommand.createCommandLine
> (line 87): this line says file.getName(), which per the java spec will
> return just the file name, but not the path. I believe if this call were
> changed to file.getPath(), that it would resolve the problem.
> While finding this problem, I noticed that PerforceRemoveCommand:90 has
> exactly the same bug.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)