Skip to content

Commit

Permalink
[SCM-1003] gitexe remove command fails for filenames which start with…
Browse files Browse the repository at this point in the history
… '-'

This closes #163
  • Loading branch information
michael-o committed Oct 15, 2022
1 parent bb811c5 commit 1624f4b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ public static Commandline createCommandLine( File workingDirectory, List<File> f
}
}

// use this separator to make clear that the following parameters are files and options.
cl.createArg().setValue( "--" );

GitCommandLineUtils.addTarget( cl, files );

return cl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void testCommandRemoveWithFile()

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

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

FileUtils.deleteDirectory( workingDirectory );
}
Expand All @@ -63,7 +63,7 @@ public void testCommandRemoveWithDirectory()

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

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

FileUtils.deleteDirectory( workingDirectory );
}
Expand All @@ -83,7 +83,7 @@ public void testCommandRemoveWithTwoDirectory()
Commandline cl =
GitRemoveCommand.createCommandLine( workingDirectory, Arrays.asList( toBeRemoved1, toBeRemoved2 ) );

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

FileUtils.deleteDirectory( workingDirectory );
}
Expand Down

0 comments on commit 1624f4b

Please sign in to comment.