feat(cli): allow skipping branch validation (#6721)

This commit is contained in:
Alexander Petric
2025-10-01 11:04:06 -04:00
committed by GitHub
parent 2b95f82839
commit 52bf2eb9c1
3 changed files with 9 additions and 7 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ export async function pushGitSyncSettings(
) {
// Validate branch configuration like sync commands
try {
await validateBranchConfiguration();
await validateBranchConfiguration({ yes: opts.yes });
} catch (error) {
if (error instanceof Error && error.message.includes("overrides")) {
log.error(error.message);
+4 -2
View File
@@ -1265,7 +1265,7 @@ export async function pull(
// Validate branch configuration early
try {
await validateBranchConfiguration(false, opts.yes);
await validateBranchConfiguration(opts);
} catch (error) {
if (error instanceof Error && error.message.includes("overrides")) {
log.error(error.message);
@@ -1690,7 +1690,7 @@ export async function push(
// Validate branch configuration early
try {
await validateBranchConfiguration(false, opts.yes);
await validateBranchConfiguration(opts);
} catch (error) {
if (error instanceof Error && error.message.includes("overrides")) {
log.error(error.message);
@@ -2358,6 +2358,7 @@ const command = new Command()
.option("--include-groups", "Include syncing groups")
.option("--include-settings", "Include syncing workspace settings")
.option("--include-key", "Include workspace encryption key")
.option("--skip-branch-validation", "Skip git branch validation and prompts")
.option("--json-output", "Output results in JSON format")
.option(
"-i --includes <patterns:file[]>",
@@ -2405,6 +2406,7 @@ const command = new Command()
.option("--include-groups", "Include syncing groups")
.option("--include-settings", "Include syncing workspace settings")
.option("--include-key", "Include workspace encryption key")
.option("--skip-branch-validation", "Skip git branch validation and prompts")
.option("--json-output", "Output results in JSON format")
.option(
"-i --includes <patterns:file[]>",
+4 -4
View File
@@ -36,6 +36,7 @@ export interface SyncOptions {
includeGroups?: boolean;
includeSettings?: boolean;
includeKey?: boolean;
skipBranchValidation?: boolean;
message?: string;
includes?: string[];
extraIncludes?: string[];
@@ -355,10 +356,9 @@ export async function mergeConfigWithConfigFile<T>(
// Validate branch configuration early in the process
export async function validateBranchConfiguration(
skipValidation?: boolean,
autoAccept?: boolean
opts: Pick<SyncOptions, "skipBranchValidation" | "yes">
): Promise<void> {
if (skipValidation || !isGitRepository()) {
if (opts.skipBranchValidation || !isGitRepository()) {
return;
}
@@ -400,7 +400,7 @@ export async function validateBranchConfiguration(
);
const shouldCreate =
autoAccept ||
opts.yes ||
(await Confirm.prompt({
message: `Create empty branch configuration for '${currentBranch}'?`,
default: true,