- Generate patches in xsa.git
- Update the recipe for that version in `xsa213.meta`
+
+`xsatool 213 dedup-patches`
+
+Sync-patches will always generate a separate set of patches for each
+version. But it's often the case that a single patch or set of
+patches can apply to multiple versions.
+
+This command will go through the supported versions, from newest to
+oldest, checking to see if the patches in the recipe are functionally
+equivalent to those in the next higher version:
+
+ - Create a branch called `xsa/dedup-canonical` using the current
+ recipe for version `${v}`
+
+ - Attempt to create a branch called `xsa/dedup-candidate` using the
+ recipe for version `${v}+1`. If the `git am` fails, the current
+ patches are not redundant and move on to the next version.
+
+ - Compare a hash of the two trees (generated with `git rev-partse
+ $branch:`). If they match, replace the recipe `${v}` with the
+ recipe for `${v}+1`. Otherwise, leave it as it is.
+
+NB at the moment this only works for the xen repo.
## Creating XSA metadata from existing patches