Skip to content

The Unified and Autonomous Development Platform

fix: Update commit message suggestion and enhance directory deletion method

Robin Shen35dba924ba92
diff --git a/server-core/src/main/java/io/onedev/server/model/support/issue/CommitMessageFixSetting.java b/server-core/src/main/java/io/onedev/server/model/support/issue/CommitMessageFixSetting.java
index 85496111bb..bf223dfd63 100644
--- a/server-core/src/main/java/io/onedev/server/model/support/issue/CommitMessageFixSetting.java
+++ b/server-core/src/main/java/io/onedev/server/model/support/issue/CommitMessageFixSetting.java
@@ -36,7 +36,7 @@ public class CommitMessageFixSetting implements Serializable, Validatable {
private static final long serialVersionUID = 1L;
public static final String DEFAULT_FIX_SUGGESTION = """
- When a commit is intended to fix/close/resolve an issue, add the issue reference in the commit message \
+ When a commit is intended to resolve/fix/close an issue, add the issue reference in the commit message \
footer as a separate line, for instance:
Fixes #100
diff --git a/server-core/src/main/java/io/onedev/server/notification/PullRequestNotificationManager.java b/server-core/src/main/java/io/onedev/server/notification/PullRequestNotificationManager.java
index 4ea77dd6a8..3c9b0d8e3c 100644
--- a/server-core/src/main/java/io/onedev/server/notification/PullRequestNotificationManager.java
+++ b/server-core/src/main/java/io/onedev/server/notification/PullRequestNotificationManager.java
@@ -262,8 +262,8 @@ public class PullRequestNotificationManager implements Serializable {
&& canCreateWorkspace(request.getSubmitter(), request)) {
var prompt = """
Work on pull request %d to address user feedbacks since your last work. \
- Do not mention users in any comments if will change the code \
- as this change will notify users automatically. \
+ If code is changed as a result of this, make sure to not mention users \
+ in your comments; otherwise, mention users only when you expect a response. \
Make sure to submit work afterwards without confirmation."""
.formatted(request.getNumber());
var commitId = request.getLatestUpdate().getHeadCommit().copy();
@@ -343,8 +343,9 @@ public class PullRequestNotificationManager implements Serializable {
var prompt = """
Work on pull request %d to perform the review. \
Stay on current checkout and do not modify code. \
- Do not mention users in any comments if you will change your review state
- as this change will notify users automatically. \
+ If review state is changed as a result of this, \
+ make sure to not mention users in the review notes or comments; \
+ otherwise, mention users only when you expect a response. \
Make sure to submit work afterwards without confirmation."""
.formatted(request.getNumber(), request.getSubmitter().getName());
var commitId = request.getLatestUpdate().getHeadCommit().copy();
diff --git a/server-core/src/main/java/io/onedev/server/workspace/ServerProvisionerUtils.java b/server-core/src/main/java/io/onedev/server/workspace/ServerProvisionerUtils.java
index fbd2a88ea5..8ff169afda 100644
--- a/server-core/src/main/java/io/onedev/server/workspace/ServerProvisionerUtils.java
+++ b/server-core/src/main/java/io/onedev/server/workspace/ServerProvisionerUtils.java
@@ -48,7 +48,7 @@ public final class ServerProvisionerUtils {
OneDev.getInstance(ClusterService.class).runOnServer(pinnedServer, () -> {
var workspaceDir = getWorkspaceDir(projectId, workspaceNumber);
if (workspaceDir.exists())
- FileUtils.deleteDir(workspaceDir);
+ FileUtils.deleteDir(workspaceDir, 5);
return null;
});
} else {