aboutsummaryrefslogtreecommitdiff
path: root/internal/engine/apply.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-16 09:39:59 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-16 09:39:59 +0200
commit6ef83d6bdfb6120f9e1fbd145e0bc463196103d1 (patch)
tree8eee1f2c29dcbef4ed96b23b08273d42ba0b5d49 /internal/engine/apply.go
parent27eb6353030953e91a45b0104bd0567e53622090 (diff)
downloadkrino-6ef83d6bdfb6120f9e1fbd145e0bc463196103d1.tar.gz
krino-6ef83d6bdfb6120f9e1fbd145e0bc463196103d1.zip
gui: History and undo tab; each plan and undo is its own run
Diffstat (limited to 'internal/engine/apply.go')
-rw-r--r--internal/engine/apply.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/internal/engine/apply.go b/internal/engine/apply.go
index 46026ba..0d894c6 100644
--- a/internal/engine/apply.go
+++ b/internal/engine/apply.go
@@ -8,6 +8,7 @@ import (
"fmt"
"io"
"os"
+ "path"
"path/filepath"
"sort"
"strings"
@@ -990,7 +991,7 @@ func (e *Engine) declineUndoFile(f UndoFile, j *journal.Writer, run string) (Fil
return FileResult{}, err
}
}
- return FileResult{Steps: steps}, nil
+ return FileResult{File: undoFileIdentity(f), Steps: steps}, nil
}
// undoFile executes every step of f in order (already last-original-step
@@ -1034,7 +1035,16 @@ func (e *Engine) undoFile(f UndoFile, j *journal.Writer, run string) (FileResult
return FileResult{}, err
}
}
- return FileResult{Steps: steps}, nil
+ return FileResult{File: undoFileIdentity(f), Steps: steps}, nil
+}
+
+// undoFileIdentity is all an undo result can honestly say about the file it
+// reversed: the log records its path relative to the directory root and
+// nothing else - the file's size, mode and times belong to a state that no
+// longer exists. A front end showing a row per file matches on Rel (GUI
+// design ยง4); it must not read the rest.
+func undoFileIdentity(f UndoFile) scan.File {
+ return scan.File{Rel: f.File, Name: path.Base(f.File)}
}
// runUndoStep actually carries out one reversal. It reuses apply.StepResult