git: Avoid removing project excerpts for dirty buffers (#44312)

Imitating the approach of #41829. Prevents e.g. reverting a hunk and
having that excerpt yanked out from under the cursor.

Release Notes:

- git: Improved stability of excerpts when editing in the project diff.
86aa9abc90Cole Miller committed on 12/15/2025, 2:48:15 AM· committed by GitHubparenta51585d
6 files changedLine totals unavailable