Skip to content

Commit

Permalink
#5 Add StandardCopyOption to allow git hooks to be overriden.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewhitt committed Feb 5, 2019
1 parent 8a63b51 commit 86090af
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/com/rudikershaw/gitbuildhook/InstallMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoFailureException;
Expand Down Expand Up @@ -99,7 +100,8 @@ public void execute() throws MojoFailureException {
private void installGitHook(final GitHookType hookType, final String filePath, final String hooksDirectory) {
if (filePath != null) {
try {
Files.copy(Paths.get(filePath), Paths.get(hooksDirectory + "/" + hookType.getHookFileName()));
Files.copy(Paths.get(filePath), Paths.get(hooksDirectory + "/" + hookType.getHookFileName()),
StandardCopyOption.REPLACE_EXISTING);
} catch (final IOException e) {
getLog().warn("Could not move file into .git/hooks directory", e);
}
Expand Down

0 comments on commit 86090af

Please sign in to comment.