diff --git a/packages/core/src/resource/branchCreate.ts b/packages/core/src/resource/branchCreate.ts index 07d5ad7..6d7461c 100644 --- a/packages/core/src/resource/branchCreate.ts +++ b/packages/core/src/resource/branchCreate.ts @@ -1,5 +1,6 @@ import fs from 'node:fs' import path from 'pathe' +import { nanoid } from 'nanoid' import { getLocalDbFolder } from '../storage/path.js' import { copyDir, ensureDir } from '../util/fs.js' import type { MoquerieInstance } from '../instance.js' @@ -42,3 +43,13 @@ export async function createBranch(mq: MoquerieInstance, options: CreateBranchOp await copyDir(currentBranchFolder, newBranchFolder) } } + +/** + * Creates an empty branch with a random name. + */ +export async function createEmptyBranch(mq: MoquerieInstance) { + return createBranch(mq, { + name: `test-${nanoid()}`, + empty: true, + }) +}