fix(tasktree): normalize backup worktree path
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { join, relative } from "node:path";
|
||||
import { test } from "bun:test";
|
||||
|
||||
import {
|
||||
@@ -110,7 +110,7 @@ test("TaskTree restore diff reports create, update, and delete independently", (
|
||||
assert.deepEqual(restoreDiff(snapshot, incoming).tasks, { create: 1, update: 1, delete: 1 });
|
||||
});
|
||||
|
||||
test("TaskTree Git backup publishes once and deduplicates identical content", async () => {
|
||||
test("TaskTree Git backup accepts a relative worktree path and deduplicates identical content", async () => {
|
||||
const root = mkdtempSync(join(tmpdir(), "tasktree-backup-test-"));
|
||||
const remote = join(root, "remote.git");
|
||||
const worktree = join(root, "worktree");
|
||||
@@ -121,7 +121,7 @@ test("TaskTree Git backup publishes once and deduplicates identical content", as
|
||||
repoSshUrl: remote,
|
||||
branch: "main",
|
||||
basePath: "tasktree/test",
|
||||
worktreePath: worktree,
|
||||
worktreePath: relative(process.cwd(), worktree),
|
||||
target: "test",
|
||||
sshCommand: "",
|
||||
authorName: "TaskTree Test",
|
||||
|
||||
@@ -34,7 +34,14 @@ export type PublishedTaskTreeBackup = {
|
||||
let gitQueue: Promise<unknown> = Promise.resolve();
|
||||
|
||||
export class TaskTreeGitBackup {
|
||||
constructor(readonly config: TaskTreeGitBackupConfig) {}
|
||||
readonly config: TaskTreeGitBackupConfig;
|
||||
|
||||
constructor(config: TaskTreeGitBackupConfig) {
|
||||
this.config = {
|
||||
...config,
|
||||
worktreePath: resolve(config.worktreePath),
|
||||
};
|
||||
}
|
||||
|
||||
async publish(snapshot: TaskTreeSnapshot, reason: string): Promise<PublishedTaskTreeBackup> {
|
||||
return enqueueGit(async () => {
|
||||
|
||||
Reference in New Issue
Block a user