History diff: keep a stepped-back object in place; number hunks right

Rewind put an object's old form at the end of its list, so a history
entry's diff showed the changed object moving (turning hairpin off for
one forward also moved its forward and DNAT lines). It now sorts after
stepping back. go-udiff v0.4.1 numbers the new side of hunks after one
with a moved line too early, so the chain after @@ could be the one
before; hunkStarts numbers them again. History diffs name their sides
"before N" and "after N".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
abrown38andClaude Opus 5.5 committed 2026-10-23 10:49:41 +01:00
1 parent 540f4b85ac
commit 0d16358617
4 files changed
+143 -2

No files matched your search

+2
View File
@@ -335,6 +335,8 @@ func Rewind(st *model.State, h *model.HistoryEntry) error {
return err
}
}
// put appends what it brings back; its position puts it in place.
st.Sort()
return nil
}