-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Introduce scan.primary-branch which is symmetrical to scan.fallback-branch #7553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -709,10 +709,19 @@ public void deleteBranch(String branchName) { | |
| && branchName.equals(fallbackBranch)) { | ||
| throw new IllegalArgumentException( | ||
| String.format( | ||
| "can not delete the fallback branch. " | ||
| + "branchName to be deleted is %s. you have set 'scan.fallback-branch' = '%s'. " | ||
| + "you should reset 'scan.fallback-branch' before deleting this branch.", | ||
| branchName, fallbackBranch)); | ||
| "Cannot delete branch '%s' because it is configured as" | ||
| + " 'scan.fallback-branch'. Unset 'scan.fallback-branch' first.", | ||
| branchName)); | ||
| } | ||
|
|
||
| String primaryBranch = coreOptions().toConfiguration().get(CoreOptions.SCAN_PRIMARY_BRANCH); | ||
| if (!StringUtils.isNullOrWhitespaceOnly(primaryBranch) | ||
| && branchName.equals(primaryBranch)) { | ||
| throw new IllegalArgumentException( | ||
| String.format( | ||
|
Comment on lines
+717
to
+721
|
||
| "Cannot delete branch '%s' because it is configured as" | ||
| + " 'scan.primary-branch'. Unset 'scan.primary-branch' first.", | ||
| branchName)); | ||
| } | ||
|
|
||
| branchManager().dropBranch(branchName); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If table options contain
primary-keywith an empty value (e.g.''), the new condition!primaryKeys.isEmpty() && !StringUtils.isEmpty(pk)will skip the conflict check and then overwrite the DDL-defined primary key with an empty list (becausepk.split(",")yields only empty tokens). That silently drops the primary key definition. It would be safer to treat null/blankpkas “option not set” (ignore it and keep the DDLprimaryKeys) instead of normalizing it into an empty PK list.