Search backend: add diff formatting function
Created by: camdencheek
Adds a formatting function to invert ParseDiffString. I'd like to save the structured form of diff on the result type, but I want to be able to easily get the original format back.
Stacked on https://github.com/sourcegraph/sourcegraph/pull/39378
Test plan
Added an assertion that round-trip reformatting works as expected.