fix(workspace): report only the active notepad change
This commit is contained in:
@@ -41,7 +41,7 @@ export function formatFileChanges(stats: GitFileStat[], notepadPath?: string): s
|
|||||||
const normalizedNotepadPath = normalizePath(notepadPath)
|
const normalizedNotepadPath = normalizePath(notepadPath)
|
||||||
const notepadStat = stats.find((s) => {
|
const notepadStat = stats.find((s) => {
|
||||||
const normalizedPath = normalizePath(s.path)
|
const normalizedPath = normalizePath(s.path)
|
||||||
return normalizedPath === normalizedNotepadPath || normalizedPath.includes(".omo/notepads/")
|
return normalizedPath === normalizedNotepadPath
|
||||||
})
|
})
|
||||||
if (notepadStat) {
|
if (notepadStat) {
|
||||||
lines.push("[NOTEPAD UPDATED]")
|
lines.push("[NOTEPAD UPDATED]")
|
||||||
|
|||||||
@@ -65,4 +65,12 @@ describe("git-worktree", () => {
|
|||||||
expect(summary).toContain("[NOTEPAD UPDATED]")
|
expect(summary).toContain("[NOTEPAD UPDATED]")
|
||||||
expect(summary).toContain(".omo/notepads/work/notes.md")
|
expect(summary).toContain(".omo/notepads/work/notes.md")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("#given notepad path #when formatting another omo notepad change #then does not report active notepad updated", () => {
|
||||||
|
const summary = formatFileChanges([
|
||||||
|
{ path: ".omo/notepads/other/notes.md", added: 1, removed: 0, status: "modified" },
|
||||||
|
], ".omo/notepads/work/notes.md")
|
||||||
|
|
||||||
|
expect(summary).not.toContain("[NOTEPAD UPDATED]")
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user