Skip to content

Commit 6b9ed5f

Browse files
committed
[fix] Trim branch name when deleting branch
1 parent 7841b7e commit 6b9ed5f

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

paimon-core/src/main/java/org/apache/paimon/table/AbstractFileStoreTable.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,6 @@ public void createBranch(String branchName, String tagName) {
656656

657657
@Override
658658
public void deleteBranch(String branchName) {
659-
branchName = branchName.trim();
660659
String fallbackBranch =
661660
coreOptions().toConfiguration().get(CoreOptions.SCAN_FALLBACK_BRANCH);
662661
if (!StringUtils.isNullOrWhitespaceOnly(fallbackBranch)

paimon-core/src/main/java/org/apache/paimon/table/Table.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,10 @@ default void deleteTags(String tagStr) {
171171

172172
/** Delete branches, branches are separated by commas. */
173173
@Experimental
174-
default void deleteBranches(String branchNames) {
175-
for (String branch : branchNames.split(",")) {
174+
default void deleteBranches(String branchNamesStr) {
175+
String[] branchNames =
176+
Arrays.stream(branchNamesStr.split(",")).map(String::trim).toArray(String[]::new);
177+
for (String branch : branchNames) {
176178
deleteBranch(branch);
177179
}
178180
}

paimon-core/src/main/java/org/apache/paimon/utils/BranchManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ default boolean branchExists(String branchName) {
5050
static String branchPath(Path tablePath, String branch) {
5151
return isMainBranch(branch)
5252
? tablePath.toString()
53-
: tablePath.toString() + "/branch/" + BRANCH_PREFIX + branch.trim();
53+
: tablePath.toString() + "/branch/" + BRANCH_PREFIX + branch;
5454
}
5555

5656
static String normalizeBranch(String branch) {

0 commit comments

Comments
 (0)