Skip to content

Commit

Permalink
feat: createEmptyBranch
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Sep 19, 2024
1 parent cbbe234 commit 97c5dfe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/core/src/resource/branchCreate.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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,
})
}

0 comments on commit 97c5dfe

Please sign in to comment.