diff options
author | Nick Mathewson <nickm@torproject.org> | 2023-10-12 12:27:58 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2023-10-12 12:27:58 -0400 |
commit | f7e5a95ee96d8ef52c1732d066c1249a6f84391e (patch) | |
tree | 2e1ddd85f471143518d0df7c7645d066d43bc149 /spec/dir-spec/limited-ed-diff-format.md | |
parent | e4e0d93d56ee8c1aec4c2efaa7046b651f0fe55c (diff) | |
download | torspec-f7e5a95ee96d8ef52c1732d066c1249a6f84391e.tar.gz torspec-f7e5a95ee96d8ef52c1732d066c1249a6f84391e.zip |
Convert text specifications to mdbook.
Diffstat (limited to 'spec/dir-spec/limited-ed-diff-format.md')
-rw-r--r-- | spec/dir-spec/limited-ed-diff-format.md | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/dir-spec/limited-ed-diff-format.md b/spec/dir-spec/limited-ed-diff-format.md new file mode 100644 index 0000000..35b5200 --- /dev/null +++ b/spec/dir-spec/limited-ed-diff-format.md @@ -0,0 +1,39 @@ +<a id="dir-spec.txt-E"></a> +# Limited ed diff format + +We support the following format for consensus diffs. It's a +subset of the ed diff format, but clients MUST NOT accept other +ed commands. + +We support the following ed commands, each on a line by itself: + +```text + - "<n1>d" Delete line n1 + - "<n1>,<n2>d" Delete lines n1 through n2, inclusive + - "<n1>,$d" Delete line n1 through the end of the file, inclusive. + - "<n1>c" Replace line n1 with the following block + - "<n1>,<n2>c" Replace lines n1 through n2, inclusive, with the + following block. + - "<n1>a" Append the following block after line n1. +``` + +Note that line numbers always apply to the file after all previous +commands have already been applied. Note also that line numbers +are 1-indexed. + +The commands MUST apply to the file from back to front, such that +lines are only ever referred to by their position in the original +file. + +If there are any directory signatures on the original document, the +first command MUST be a "<n1>,$d" form to remove all of the directory +signatures. Using this format ensures that the client will +successfully apply the diff even if they have an unusual encoding for +the signatures. + +The replace and append command take blocks. These blocks are simply +appended to the diff after the line with the command. A line with +just a period (".") ends the block (and is not part of the lines +to add). Note that it is impossible to insert a line with just +a single dot. + |