fix: write the current answer into an entry the ledger forgot
A desktop entry that was edited in place is left alone once it carries the marker, and the only thing that ever writes it again is the undo a change of flags goes through - which reads the ledger. So an entry the ledger has lost is one nothing looks at any more: it keeps whatever an older version put on its command line, and an update that moves browsers to a different flag moves every browser but that one. The copy taken before the edit is named after the path, not recorded in the ledger, and is still there. A marked entry with no ledger line is now put back from that copy and written again from scratch, which is the same thing the undo would have done, and it lands in the ledger on the way out. Only entries edited in place need this. A generated entry is built from the source entry every time and is right by construction, and a flag file has its block rewritten whenever the contents differ.
This commit is contained in:
1 parent
dcdf2c1df3
commit
2ea64d0603
2 files changed
+24
-2
No files matched your search
@@ -293,6 +293,16 @@ mca_ledger_add() {
|
||||
printf '%s\t%s\t%s\n' "$kind" "$path" "$detail" >> "$MCA_LEDGER"
|
||||
}
|
||||
|
||||
# mca_ledger_has <path>
|
||||
# Whether the ledger still knows about that file. Worth asking because the copy
|
||||
# kept beside it is named after the path and outlives a ledger that was lost or
|
||||
# truncated: a file nothing has a record of any more is one nothing would ever
|
||||
# look at again.
|
||||
mca_ledger_has() {
|
||||
[[ -f $MCA_LEDGER ]] || return 1
|
||||
awk -F'\t' -v p="$1" '$2 == p { found = 1 } END { exit !found }' "$MCA_LEDGER"
|
||||
}
|
||||
|
||||
mca_ledger_forget() {
|
||||
local path="$1" tmp
|
||||
[[ -f $MCA_LEDGER ]] || return 0
|
||||
|
||||
Reference in new issue
Block a user