{tx(error)}
diff --git a/src/features/vcs/__tests__/directoryCompare.test.tsx b/src/features/vcs/__tests__/directoryCompare.test.tsx
index dbc2d94c8..79a616029 100644
--- a/src/features/vcs/__tests__/directoryCompare.test.tsx
+++ b/src/features/vcs/__tests__/directoryCompare.test.tsx
@@ -6,6 +6,8 @@ const mocks = vi.hoisted(() => ({
compare: vi.fn(),
cancel: vi.fn(),
sync: vi.fn(),
+ kind: vi.fn(),
+ choose: vi.fn(),
confirm: vi.fn(),
open: vi.fn(),
}));
@@ -17,6 +19,7 @@ vi.mock("@/platform/ipc", async (original) => {
...real.commands,
fsCompareDirectories: mocks.compare,
fsSynchronizeDirectories: mocks.sync,
+ fsEntryKind: mocks.kind,
cancelRequest: mocks.cancel,
},
};
@@ -27,6 +30,7 @@ vi.mock("@tauri-apps/api/core", async (original) => ({
onmessage = () => {};
},
}));
+vi.mock("@/platform/choosePath", () => ({ choosePath: mocks.choose }));
vi.mock("../DiffEditor", () => ({
DiffEditor: ({ input }: { input: unknown }) =>
{JSON.stringify(input)}
,
}));
@@ -67,6 +71,7 @@ beforeEach(() => {
vi.clearAllMocks();
mocks.compare.mockResolvedValue(ok(rows));
mocks.sync.mockResolvedValue(ok([]));
+ mocks.kind.mockResolvedValue(ok("dir"));
mocks.confirm.mockResolvedValue(true);
});
afterEach(cleanup);
@@ -234,6 +239,33 @@ describe("disk directory comparison", () => {
localStorage.removeItem("openidea.directoryCompare.mode");
});
+ it("compares other folders typed into the path fields or chosen with the folder chooser", async () => {
+ const change = vi.fn();
+ render(
);
+ const leftField = screen.getByRole("textbox", { name: "Left folder" });
+ expect(leftField).toHaveValue("/p/left");
+ fireEvent.change(leftField, { target: { value: "/p/other" } });
+ fireEvent.keyDown(leftField, { key: "Enter" });
+ await waitFor(() => expect(change).toHaveBeenCalledWith("/p/other", "/p/right"));
+ expect(mocks.kind).toHaveBeenCalledWith("/p/other");
+ // A file, or the folder already on the other side, is refused with a message.
+ mocks.kind.mockResolvedValueOnce(ok("file"));
+ const rightField = screen.getByRole("textbox", { name: "Right folder" });
+ fireEvent.change(rightField, { target: { value: "/p/file.txt" } });
+ fireEvent.blur(rightField);
+ expect(await screen.findByRole("alert")).toHaveTextContent("/p/file.txt is not a folder");
+ fireEvent.change(rightField, { target: { value: "/p/left" } });
+ fireEvent.keyDown(rightField, { key: "Enter" });
+ expect(await screen.findByText("Choose two different folders")).toBeInTheDocument();
+ fireEvent.keyDown(rightField, { key: "Escape" });
+ expect(rightField).toHaveValue("/p/right");
+ mocks.choose.mockResolvedValueOnce("/p/chosen");
+ fireEvent.click(screen.getByRole("button", { name: "Choose right folder" }));
+ await waitFor(() => expect(change).toHaveBeenCalledWith("/p/left", "/p/chosen"));
+ expect(mocks.choose).toHaveBeenCalledWith(expect.objectContaining({ directory: true, defaultPath: "/p/right" }));
+ expect(change).toHaveBeenCalledTimes(2);
+ });
+
it("streams progress, cancels on demand and on close, and ignores stale results after refresh", async () => {
let resolve!: (value: unknown) => void;
mocks.compare.mockImplementationOnce((_l, _r, _mode, _request, channel) => {
diff --git a/src/platform/locales/text/es.json b/src/platform/locales/text/es.json
index 8990e530b..109fd082f 100644
--- a/src/platform/locales/text/es.json
+++ b/src/platform/locales/text/es.json
@@ -5513,8 +5513,6 @@
"Compared files": "Archivos comparados",
"Comparison cancelled": "Comparación cancelada",
"No matching differences": "No hay diferencias coincidentes",
- "Left: {left}": "Izquierda: {left}",
- "Right: {right}": "Derecha: {right}",
"Compared {compared} of {total} entries": "Se compararon {compared} de {total} entradas",
"Scanned {scanned} entries": "Se escanearon {scanned} entradas",
"Binary content": "Contenido binario",
diff --git a/src/platform/locales/text/fr.json b/src/platform/locales/text/fr.json
index b7e3faec1..73bf51425 100644
--- a/src/platform/locales/text/fr.json
+++ b/src/platform/locales/text/fr.json
@@ -5339,8 +5339,6 @@
"Compared files": "Fichiers comparés",
"Comparison cancelled": "Comparaison annulée",
"No matching differences": "Aucune différence correspondante",
- "Left: {left}": "Gauche : {left}",
- "Right: {right}": "Droite : {right}",
"Compared {compared} of {total} entries": "{compared} entrées comparées sur {total}",
"Scanned {scanned} entries": "{scanned} entrées analysées",
"Binary content": "Contenu binaire",
diff --git a/src/platform/locales/text/ko.json b/src/platform/locales/text/ko.json
index 08f97131a..2a505525b 100644
--- a/src/platform/locales/text/ko.json
+++ b/src/platform/locales/text/ko.json
@@ -5581,8 +5581,6 @@
"Compared files": "비교된 파일",
"Comparison cancelled": "비교가 취소되었습니다",
"No matching differences": "일치하는 차이점이 없습니다",
- "Left: {left}": "왼쪽: {left}",
- "Right: {right}": "오른쪽: {right}",
"Compared {compared} of {total} entries": "항목 {total}개 중 {compared}개 비교됨",
"Scanned {scanned} entries": "항목 {scanned}개 스캔됨",
"Binary content": "바이너리 내용",
diff --git a/src/platform/locales/text/pl.json b/src/platform/locales/text/pl.json
index 935882b18..cef64f7ad 100644
--- a/src/platform/locales/text/pl.json
+++ b/src/platform/locales/text/pl.json
@@ -5465,8 +5465,6 @@
"Compared files": "Porównywane pliki",
"Comparison cancelled": "Porównywanie anulowane",
"No matching differences": "Brak pasujących różnic",
- "Left: {left}": "Lewa strona: {left}",
- "Right: {right}": "Prawa strona: {right}",
"Compared {compared} of {total} entries": "Porównano {compared} z {total} wpisów",
"Scanned {scanned} entries": "Przeskanowano wpisy ({scanned})",
"Binary content": "Zawartość binarna",
diff --git a/src/platform/locales/text/pt.json b/src/platform/locales/text/pt.json
index 029d3eb2a..ab82c846b 100644
--- a/src/platform/locales/text/pt.json
+++ b/src/platform/locales/text/pt.json
@@ -5479,8 +5479,6 @@
"Compared files": "Arquivos comparados",
"Comparison cancelled": "Comparação cancelada",
"No matching differences": "Nenhuma diferença correspondente",
- "Left: {left}": "Esquerda: {left}",
- "Right: {right}": "Direita: {right}",
"Compared {compared} of {total} entries": "{compared} de {total} entradas comparadas",
"Scanned {scanned} entries": "{scanned} entradas verificadas",
"Binary content": "Conteúdo binário",
diff --git a/src/platform/locales/text/tr.json b/src/platform/locales/text/tr.json
index 2e4627513..9ccd3dd14 100644
--- a/src/platform/locales/text/tr.json
+++ b/src/platform/locales/text/tr.json
@@ -8185,8 +8185,6 @@
"Compared files": "Karşılaştırılan dosyalar",
"Comparison cancelled": "Karşılaştırma iptal edildi",
"No matching differences": "Eşleşen fark yok",
- "Left: {left}": "Sol: {left}",
- "Right: {right}": "Sağ: {right}",
"Compared {compared} of {total} entries": "{total} öğenin {compared} tanesi karşılaştırıldı",
"Scanned {scanned} entries": "{scanned} öğe tarandı",
"Binary content": "İkili içerik",
diff --git a/src/platform/locales/text/zh-TW.json b/src/platform/locales/text/zh-TW.json
index 45fa03f08..a11c64386 100644
--- a/src/platform/locales/text/zh-TW.json
+++ b/src/platform/locales/text/zh-TW.json
@@ -6510,8 +6510,6 @@
"Compared files": "比較的檔案",
"Comparison cancelled": "已取消比較",
"No matching differences": "沒有符合的差異",
- "Left: {left}": "左側:{left}",
- "Right: {right}": "右側:{right}",
"Compared {compared} of {total} entries": "已比較 {compared} / {total} 個條目",
"Scanned {scanned} entries": "已掃描 {scanned} 個條目",
"Binary content": "二進位制內容",
diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json
index ebbcb9ba4..9c923f3a3 100644
--- a/src/platform/locales/text/zh.json
+++ b/src/platform/locales/text/zh.json
@@ -6547,8 +6547,6 @@
"Compared files": "比较的文件",
"Comparison cancelled": "已取消比较",
"No matching differences": "没有匹配的差异",
- "Left: {left}": "左侧:{left}",
- "Right: {right}": "右侧:{right}",
"Compared {compared} of {total} entries": "已比较 {compared} / {total} 个条目",
"Scanned {scanned} entries": "已扫描 {scanned} 个条目",
"Binary content": "二进制内容",
@@ -6748,6 +6746,12 @@
"Synchronize": "同步",
"Synchronize {count} entries? {deletes} will be deleted and {overwrites} overwritten.": "同步 {count} 个条目?其中 {deletes} 个将被删除,{overwrites} 个将被覆盖。",
"Synchronizing directories": "正在同步目录",
+ "Left folder": "左侧文件夹",
+ "Right folder": "右侧文件夹",
+ "Choose left folder": "选择左侧文件夹",
+ "Choose right folder": "选择右侧文件夹",
+ "{path} is not a folder": "{path} 不是文件夹",
+ "Choose two different folders": "请选择两个不同的文件夹",
"Stop content comparison": "停止内容比较",
"Filter:": "筛选:",
"Local files": "本地文件",