Skip to content

Commit

Permalink
Update worktree test to support windows paths with \ by using File.se…
Browse files Browse the repository at this point in the history
…parator
  • Loading branch information
summersb authored and rudikershaw committed Dec 14, 2023
1 parent 1d66b65 commit dea4b7c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.rudikershaw.gitbuildhook;

import java.io.File;
import java.io.IOException;
import java.util.Map;

Expand Down Expand Up @@ -44,7 +45,8 @@ public void execute() throws MojoFailureException {
final FileRepositoryBuilder repoBuilder = new FileRepositoryBuilder();
repoBuilder.findGitDir(project.getBasedir());

if (repoBuilder.getGitDir().getAbsolutePath().contains(".git/worktrees/")) {
final String worktreePath = ".git" + File.separator + "worktrees" + File.separator;
if (repoBuilder.getGitDir().getAbsolutePath().contains(worktreePath)) {
getLog().warn(
"The plugin appears to be running in a Git worktree. "
+ "No configuration changes made."
Expand Down

0 comments on commit dea4b7c

Please sign in to comment.