Skip to content

Commit e891db7

Browse files
committed
Fix Windows tag checkout result
1 parent efcc410 commit e891db7

2 files changed

Lines changed: 35 additions & 2 deletions

File tree

windows/tauri/src/platform/core-result-adapter.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,36 @@ describe("git checkout result adaptation", () => {
3737
});
3838
});
3939

40+
describe("git tag checkout result adaptation", () => {
41+
test("maps a successful core tag checkout to the UI checkout result", () => {
42+
const result = adaptCoreResult(
43+
"git_checkout_tag",
44+
{ repoPath: "C:/work", name: "v0.3.0" },
45+
{ output: "HEAD is now at abc1234 Release 0.3.0\n", exitCode: 0 },
46+
);
47+
48+
expect(result).toEqual({
49+
success: true,
50+
hasChanges: false,
51+
message: "HEAD is now at abc1234 Release 0.3.0",
52+
});
53+
});
54+
55+
test("reports failure when the core tag checkout exited non-zero", () => {
56+
const result = adaptCoreResult(
57+
"git_checkout_tag",
58+
{ repoPath: "C:/work", name: "missing-tag" },
59+
{ output: "error: pathspec 'missing-tag' did not match", exitCode: 1 },
60+
);
61+
62+
expect(result).toEqual({
63+
success: false,
64+
hasChanges: false,
65+
message: "error: pathspec 'missing-tag' did not match",
66+
});
67+
});
68+
});
69+
4070
describe("git checkout preflight adaptation", () => {
4171
test("reports blocked paths returned by the shared core", () => {
4272
const result = adaptCoreResult(

windows/tauri/src/platform/core-result-adapter.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,11 @@ export function adaptCoreResult<T>(
229229
: [];
230230
return { blocked: blockingPaths.length > 0, blockingPaths } as T;
231231
}
232-
case "git_checkout_tag":
233-
return { success: true, hasChanges: false, message: "" } as T;
232+
case "git_checkout_tag": {
233+
const exitCode = typeof data.exitCode === "number" ? data.exitCode : 0;
234+
const output = typeof data.output === "string" ? data.output.trim() : "";
235+
return { success: exitCode === 0, hasChanges: false, message: output } as T;
236+
}
234237
case "git_operation_state": {
235238
const kind = typeof data.kind === "string" ? data.kind : "";
236239
if (!kind) {

0 commit comments

Comments
 (0)