Skip to content

fix: correct patch generation when discarding partial changes of staged new files#2189

Closed
gadfly3173 wants to merge 1 commit intosourcegit-scm:developfrom
gadfly3173:fix/diff-patch-generation
Closed

fix: correct patch generation when discarding partial changes of staged new files#2189
gadfly3173 wants to merge 1 commit intosourcegit-scm:developfrom
gadfly3173:fix/diff-patch-generation

Conversation

@gadfly3173
Copy link
Contributor

When a new file was already staged and the user tried to discard selected lines from the unstaged changes list, the generated patch was malformed due to incorrect index header format, wrong hunk line numbers, and unconditional "No newline at end of file" marker.

…ed new files

When a new file was already staged and the user tried to discard
selected lines from the unstaged changes list, the generated patch
was malformed due to incorrect index header format, wrong hunk line
numbers, and unconditional "No newline at end of file" marker.
love-linger added a commit that referenced this pull request Mar 13, 2026
…rtically (#2189)

Signed-off-by: leo <longshuang@msn.cn>
@love-linger
Copy link
Collaborator

I've pushed my fix for this bug - 1ca86ad

@gadfly3173
Copy link
Contributor Author

index 格式、tail null 等问题可以考虑也修一下

@gadfly3173 gadfly3173 closed this Mar 13, 2026
@love-linger
Copy link
Collaborator

  • 关于 tail 为 null 的潜在问题已经修复
  • 对于 git 对象的 hash,我倾向于不小于 8位,仅管对于空对象 0000000 也完全可以。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants