feat(file-history): mark latest history entry identical to working tree

Annotate file history entries with matches_working_tree and surface that
information in the UI so the most recent commit can be identified as
"current version" when its content equals the working tree.

- Backend: add FileHistoryCommit and annotate_file_history(...) which checks
  (only for regular files) whether the newest commit's blob matches the
  working tree via `git diff --quiet`. list_file_history now returns the
  annotated commits.
- Types: add optional matches_working_tree to GitCommit shape used by the UI.
- UI: show a "Current version"/"Aktueller Stand" badge and disable Diff/Restore
  actions for entries that match the working tree (text localized for de/en).

Also add a test that verifies the matching behavior across file edits,
staging, committing and deletion. No external API breaking changes.
This commit is contained in:
2026-09-18 20:20:46 +02:00
parent aeacb50ea6
commit 096f62907c
4 changed files with 57 additions and 4 deletions
+2
View File
@@ -260,6 +260,8 @@ export interface GitStash {
}
export interface GitCommit {
/** Set for the latest file-history entry when its diff against the working tree is empty. */
matches_working_tree?: boolean;
hash: string;
short_hash: string;
summary: string;