aboutsummaryrefslogtreecommitdiff
path: root/internal/engine/apply.go
diff options
context:
space:
mode:
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