E582 [SCM-1003] gitexe remove command fails for filenames which start with… · apache/maven-scm@1624f4b · GitHub
[go: up one dir, main page]

Skip to content

Commit 1624f4b

Browse files
committed
[SCM-1003] gitexe remove command fails for filenames which start with '-'
This closes #163
1 parent bb811c5 commit 1624f4b

File tree

2 files changed

+6
-3
lines changed
  • maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src

2 files changed

+6
-3
lines changed

maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/remove/GitRemoveCommand.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ public static Commandline createCommandLine( File workingDirectory, List<File> f
101101
}
102102
}
103103

104+
// use this separator to make clear that the following parameters are files and options.
105+
cl.createArg().setValue( "--" );
106+
104107
GitCommandLineUtils.addTarget( cl, files );
105108

106109
return cl;

maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remove/GitRemoveCommandTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void testCommandRemoveWithFile()
4747

4848
Commandline cl = GitRemoveCommand.createCommandLine( workingDirectory, Arrays.asList( toBeRemoved ) );
4949

50-
assertCommandLine( "git rm toto.xml", workingDirectory, cl );
50+
assertCommandLine( "git rm -- toto.xml", workingDirectory, cl );
5151

5252
FileUtils.deleteDirectory( workingDirectory );
5353
}
@@ -63,7 +63,7 @@ public void testCommandRemoveWithDirectory()
6363

6464
Commandline cl = GitRemoveCommand.createCommandLine( workingDirectory, Arrays.asList( toBeRemoved ) );
6565

66-
assertCommandLine( "git rm -r toto", workingDirectory, cl );
66+
assertCommandLine( "git rm -r -- toto", workingDirectory, cl );
6767

6868
FileUtils.deleteDirectory( workingDirectory );
6969
}
@@ -83,7 +83,7 @@ public void testCommandRemoveWithTwoDirectory()
8383
Commandline cl =
8484
GitRemoveCommand.createCommandLine( workingDirectory, Arrays.asList( toBeRemoved1, toBeRemoved2 ) );
8585

86-
assertCommandLine( "git rm -r toto tata", workingDirectory, cl );
86+
assertCommandLine( "git rm -r -- toto tata", workingDirectory, cl );
8787

8888
FileUtils.deleteDirectory( workingDirectory );
8989
}

0 commit comments

Comments
 (0)
0