mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-19 01:51:21 +08:00
fix: keep compat branches linear
This commit is contained in:
@@ -536,7 +536,7 @@ async function main() {
|
||||
const compatMessage = `refactor: kilo compat for ${targetVersion.tag}`
|
||||
if (prior) {
|
||||
const tree = await git.writeTree()
|
||||
const commit = await git.createMergeCommit(tree, compatMessage, targetVersion.commit, prior.commit)
|
||||
const commit = await git.createCommit(tree, compatMessage, prior.commit)
|
||||
await git.updateBranch(opencodeBranch, commit)
|
||||
await git.checkout(opencodeBranch)
|
||||
} else {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { mkdtemp, rm } from "node:fs/promises"
|
||||
import { join } from "node:path"
|
||||
import { tmpdir } from "node:os"
|
||||
import { $ } from "bun"
|
||||
import { createMergeCommit, findLatestCompatCommit, getCommitHash, updateBranch, writeTree } from "./git"
|
||||
import { createCommit, findLatestCompatCommit, getCommitHash, getCommitParents, updateBranch, writeTree } from "./git"
|
||||
|
||||
const cwd = process.cwd()
|
||||
let dir = ""
|
||||
@@ -27,7 +27,7 @@ afterEach(async () => {
|
||||
await rm(dir, { recursive: true, force: true })
|
||||
})
|
||||
|
||||
test("finds previous compatibility commit for transformed merge base", async () => {
|
||||
test("finds previous compatibility commit for transformed base", async () => {
|
||||
await Bun.write("brand.txt", "opencode A\n")
|
||||
const old = await commit("release: v1.0.0")
|
||||
|
||||
@@ -47,9 +47,10 @@ test("finds previous compatibility commit for transformed merge base", async ()
|
||||
await Bun.write("brand.txt", "kilo B\n")
|
||||
await $`git add -A`.quiet()
|
||||
const tree = await writeTree()
|
||||
const next = await createMergeCommit(tree, "refactor: kilo compat for v1.0.1", target, prior)
|
||||
const next = await createCommit(tree, "refactor: kilo compat for v1.0.1", prior)
|
||||
await updateBranch("opencode-v1.0.1", next)
|
||||
|
||||
const base = (await $`git merge-base main opencode-v1.0.1`.text()).trim()
|
||||
expect(base).toBe(prior)
|
||||
expect(await getCommitParents(next)).toEqual([prior])
|
||||
})
|
||||
|
||||
@@ -196,8 +196,8 @@ export async function writeTree(): Promise<string> {
|
||||
return result.trim()
|
||||
}
|
||||
|
||||
export async function createMergeCommit(tree: string, message: string, first: string, second: string): Promise<string> {
|
||||
const result = await $`git commit-tree ${tree} -p ${first} -p ${second} -m ${message}`.text()
|
||||
export async function createCommit(tree: string, message: string, parent: string): Promise<string> {
|
||||
const result = await $`git commit-tree ${tree} -p ${parent} -m ${message}`.text()
|
||||
return result.trim()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user