Skip to content

Strip git format-patch footer before parsing#34

Merged
unknowIfGuestInDream merged 3 commits intomasterfrom
copilot/fix-patch-file-issue
Feb 6, 2026
Merged

Strip git format-patch footer before parsing#34
unknowIfGuestInDream merged 3 commits intomasterfrom
copilot/fix-patch-file-issue

Conversation

Copy link
Contributor

Copilot AI commented Feb 6, 2026

git format-patch appends an email signature footer (-- \n<version>) to patch files. The -- line was incorrectly parsed as a deletion in the diff view.

Changes

  • Add stripGitPatchFooter() to remove the footer before passing content to diff2html
  • Regex matches footer at EOF: \n-- \n<semver>...\n?$

Example footer stripped

@@ -1,3 +1,3 @@
 Hello
-World
+Universe
-- 
2.43.0

The regex only matches footers at end-of-file, preserving legitimate -- deletion lines within diffs.

Original prompt

This section details on the original issue you should resolve

<issue_title>问题修复</issue_title>
<issue_description>git format-patch 生成的patch文件中,底部会有

- -
git版本号

在解析时会将 - - 也作为差分显示出来,请修复这个问题</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: unknowIfGuestInDream <57802425+unknowIfGuestInDream@users.noreply.github.com>
@pull-request-size pull-request-size bot added size/S and removed size/XS labels Feb 6, 2026
Co-authored-by: unknowIfGuestInDream <57802425+unknowIfGuestInDream@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with git format-patch output Strip git format-patch footer before parsing Feb 6, 2026
@unknowIfGuestInDream unknowIfGuestInDream marked this pull request as ready for review February 6, 2026 23:30
@unknowIfGuestInDream unknowIfGuestInDream merged commit ea0b9e3 into master Feb 6, 2026
5 checks passed
@unknowIfGuestInDream unknowIfGuestInDream deleted the copilot/fix-patch-file-issue branch February 6, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

问题修复

2 participants